http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java ---------------------------------------------------------------------- diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java b/agents-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java index 038c1c1..49a48cd 100644 --- a/agents-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java +++ b/agents-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.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/agents-common/src/main/java/org/apache/ranger/plugin/util/ServicePolicies.java ---------------------------------------------------------------------- diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/util/ServicePolicies.java b/agents-common/src/main/java/org/apache/ranger/plugin/util/ServicePolicies.java index 3764d1c..1ae3fc3 100644 --- a/agents-common/src/main/java/org/apache/ranger/plugin/util/ServicePolicies.java +++ b/agents-common/src/main/java/org/apache/ranger/plugin/util/ServicePolicies.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/agents-common/src/main/java/org/apache/ranger/plugin/util/ServiceTags.java ---------------------------------------------------------------------- diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/util/ServiceTags.java b/agents-common/src/main/java/org/apache/ranger/plugin/util/ServiceTags.java index 3c685e9..fed3f12 100644 --- a/agents-common/src/main/java/org/apache/ranger/plugin/util/ServiceTags.java +++ b/agents-common/src/main/java/org/apache/ranger/plugin/util/ServiceTags.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/agents-common/src/main/java/org/apache/ranger/plugin/util/TimedEventUtil.java ---------------------------------------------------------------------- diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/util/TimedEventUtil.java b/agents-common/src/main/java/org/apache/ranger/plugin/util/TimedEventUtil.java index c6a7bbe..b36d581 100644 --- a/agents-common/src/main/java/org/apache/ranger/plugin/util/TimedEventUtil.java +++ b/agents-common/src/main/java/org/apache/ranger/plugin/util/TimedEventUtil.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 @@ -38,7 +38,7 @@ public class TimedEventUtil{ }, timeout, timeUnit); } - public static <T> T timedTask(Callable<T> callableObj, long timeout, + public static <T> T timedTask(Callable<T> callableObj, long timeout, TimeUnit timeUnit) throws Exception{ return callableObj.call(); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-common/src/main/java/org/apache/ranger/services/tag/RangerServiceTag.java ---------------------------------------------------------------------- diff --git a/agents-common/src/main/java/org/apache/ranger/services/tag/RangerServiceTag.java b/agents-common/src/main/java/org/apache/ranger/services/tag/RangerServiceTag.java index f36a9a6..55384a0 100644 --- a/agents-common/src/main/java/org/apache/ranger/services/tag/RangerServiceTag.java +++ b/agents-common/src/main/java/org/apache/ranger/services/tag/RangerServiceTag.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/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerIpMatcherTest.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerIpMatcherTest.java b/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerIpMatcherTest.java index cd9c4d4..10780cf 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerIpMatcherTest.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerIpMatcherTest.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/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerSimpleMatcher.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerSimpleMatcher.java b/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerSimpleMatcher.java index 7ad7252..b9c734a 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerSimpleMatcher.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerSimpleMatcher.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/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerTimeOfDayMatcherTest.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerTimeOfDayMatcherTest.java b/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerTimeOfDayMatcherTest.java index 3611896..ec64e33 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerTimeOfDayMatcherTest.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerTimeOfDayMatcherTest.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 @@ -44,7 +44,7 @@ public class RangerTimeOfDayMatcherTest { @Test public void test_patterMatching_happyPath() { // sensible values and some goofy ones work - String[] durations = new String[] { + String[] durations = new String[] { "9am-5pm", " 9Am -5 Pm", " 9Am -5 Pm", "9 AM -5 p.m.", "9a.M - 5Pm.", "9:30am-5:30pm", " 9:00Am -5:59 Pm", " 9 am - 4 pm ", "9pm-5AM", @@ -160,8 +160,8 @@ public class RangerTimeOfDayMatcherTest { { 8, false }, {9, true }, {10, true }, - {16, true}, - {17, true}, + {16, true}, + {17, true}, {18, false }, {23, false }, }; @@ -199,9 +199,9 @@ public class RangerTimeOfDayMatcherTest { { 8, 0, false }, { 9, 15, true }, {10, 0, true }, - {17, 0, true}, - {17, 30, true}, - {17, 31, false}, + {17, 0, true}, + {17, 30, true}, + {17, 31, false}, {18, 0, false }, {22, 59, false }, {23, 0, true }, http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-common/src/test/java/org/apache/ranger/plugin/model/TestRangerPolicyResourceSignature.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/model/TestRangerPolicyResourceSignature.java b/agents-common/src/test/java/org/apache/ranger/plugin/model/TestRangerPolicyResourceSignature.java index 62cd547..eae8aa5 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/model/TestRangerPolicyResourceSignature.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/model/TestRangerPolicyResourceSignature.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 @@ -162,7 +162,7 @@ public class TestRangerPolicyResourceSignature { String expectedVersion = "version=1"; String expectedType = "type=0"; String expectedResource = "{" + - "col={values=[col1, col2, col3],excludes=false,recursive=true}, " + + "col={values=[col1, col2, col3],excludes=false,recursive=true}, " + "db={values=[db1, db2],excludes=false,recursive=false}, " + "table={values=[tbl1, tbl2, tbl3],excludes=true,recursive=false}" + "}"; http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestDirectedGraph.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestDirectedGraph.java b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestDirectedGraph.java index f58ae2b..3ec20d9 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestDirectedGraph.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestDirectedGraph.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,17 +40,17 @@ public class TestDirectedGraph { * v * AA -> BB -> CC * ^ | - * | v + * | v * EE <- DD -> FF * | * v * HH - * - * This directed graph has + * + * This directed graph has * - 1 cycle [BB CC DD EE], * - 2 sources [AA GG], * - 2 sinks [HH FF] - * - 4 hierarchies { [AA BB CC DD FF], [AA BB CC DD EE HH], [GG CC DD FF], [GG CC DD EE HH] } + * - 4 hierarchies { [AA BB CC DD FF], [AA BB CC DD EE HH], [GG CC DD FF], [GG CC DD EE HH] } */ DirectedGraph graph = new DirectedGraph(); // first add all of the arcs - from top row to bottom row and from left to right @@ -59,7 +59,7 @@ public class TestDirectedGraph { // 2nd row graph.addArc("AA", "BB"); graph.addArc("BB", "CC"); // 3rd row - graph.addArc("EE", "BB"); graph.addArc("DD", "EE"); graph.addArc("CC", "DD"); graph.addArc("DD", "FF"); + graph.addArc("EE", "BB"); graph.addArc("DD", "EE"); graph.addArc("CC", "DD"); graph.addArc("DD", "FF"); // 4th row graph.addArc("EE", "HH"); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerPolicyValidator.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerPolicyValidator.java b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerPolicyValidator.java index fecb67a..caa8e35 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerPolicyValidator.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerPolicyValidator.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 @@ -92,10 +92,10 @@ public class TestRangerPolicyValidator { "isAllowed", new Boolean[] { true, true }), ImmutableMap.of( // no users, access type different case "groups", new String[] {"group3", "group4"}, - "accesses", new String[]{"W", "x"}, + "accesses", new String[]{"W", "x"}, "isAllowed", new Boolean[] { true, true }), ImmutableMap.of( // no groups - "users", new String[] {"user3" ," user4"}, + "users", new String[] {"user3" ," user4"}, "accesses", new String[] { "r", "x" }, "isAllowed", new Boolean[] { true, true }), ImmutableMap.of( // isallowed on access types is null, case is different from that in definition @@ -110,14 +110,14 @@ public class TestRangerPolicyValidator { // { name, excludesSupported, recursiveSupported, mandatory, reg-exp, parent-level } { "db", null, null, true, "db\\d+", null }, // valid values: db1, db22, db983, etc.; invalid: db, db12x, ttx11, etc.; null => false for excludes and recursive { "tbl", true, true, true, null, "db" }, // regex == null => anything goes; excludes == true, recursive == true - { "col", false, true, false, "col\\d{1,2}", "tbl" }, // valid: col1, col47, etc.; invalid: col, col238, col1, etc., excludes == false, recursive == true + { "col", false, true, false, "col\\d{1,2}", "tbl" }, // valid: col1, col47, etc.; invalid: col, col238, col1, etc., excludes == false, recursive == true }; private final Object[][] resourceDefData_multipleHierarchies = new Object[][] { // { name, excludesSupported, recursiveSupported, mandatory, reg-exp, parent-level } { "db", null, null, true, "db\\d+", null }, // valid values: db1, db22, db983, etc.; invalid: db, db12x, ttx11, etc.; null => false for excludes and recursive { "tbl", true, true, true, null, "db" }, // regex == null => anything goes; excludes == true, recursive == true - { "col", false, true, false, "col\\d{1,2}", "tbl" }, // valid: col1, col47, etc.; invalid: col, col238, col1, etc., excludes == false, recursive == true + { "col", false, true, false, "col\\d{1,2}", "tbl" }, // valid: col1, col47, etc.; invalid: col, col238, col1, etc., excludes == false, recursive == true { "udf", true, true, true, null, "db" } // same parent as tbl (simulating hive's multiple resource hierarchies) }; @@ -135,15 +135,15 @@ public class TestRangerPolicyValidator { private final Object[][] policyResourceMap_bad = new Object[][] { // resource-name, values, excludes, recursive - { "db", new String[] { "db1", "db2" }, null, true }, // mandatory "tbl" missing; recursive==true specified when resource-def does not support it (null) + { "db", new String[] { "db1", "db2" }, null, true }, // mandatory "tbl" missing; recursive==true specified when resource-def does not support it (null) {"col", new String[] { "col12", "col 1" }, true, true }, // wrong format of value for "col"; excludes==true specified when resource-def does not allow it (false) {"extra", new String[] { "extra1", "extra2" }, null, null } // spurious "extra" specified }; private final Object[][] policyResourceMap_bad_multiple_hierarchies = new Object[][] { // resource-name, values, excludes, recursive - { "db", new String[] { "db1", "db2" }, null, true }, - { "tbl", new String[] { "tbl11", "tbl2" }, null, true }, + { "db", new String[] { "db1", "db2" }, null, true }, + { "tbl", new String[] { "tbl11", "tbl2" }, null, true }, { "col", new String[] { "col1", "col2" }, true, true }, { "udf", new String[] { "extra1", "extra2" }, null, null } // either udf or tbl/db/col should be specified, not both }; @@ -173,7 +173,7 @@ public class TestRangerPolicyValidator { _failures.clear(); Assert.assertTrue(_validator.isValid(2L, Action.DELETE, _failures)); Assert.assertTrue(_failures.isEmpty()); - // if policy exists then delete validation should pass, too! + // if policy exists then delete validation should pass, too! _failures.clear(); Assert.assertTrue(_validator.isValid(3L, Action.DELETE, _failures)); Assert.assertTrue(_failures.isEmpty()); } @@ -224,7 +224,7 @@ public class TestRangerPolicyValidator { @Test public final void testIsValid_happyPath() throws Exception { - // valid policy has valid non-empty name and service name + // valid policy has valid non-empty name and service name when(_policy.getService()).thenReturn("service-name"); // service name exists RangerService service = mock(RangerService.class); @@ -503,7 +503,7 @@ public class TestRangerPolicyValidator { RangerPolicyResourceSignature signature = mock(RangerPolicyResourceSignature.class); when(_factory.createPolicyResourceSignature(_policy)).thenReturn(signature); when(signature.getSignature()).thenReturn("hash-1"); - when(_store.getPoliciesByResourceSignature("service-name", "hash-1", true)).thenReturn(null); // store does not have any policies for that signature hash + when(_store.getPoliciesByResourceSignature("service-name", "hash-1", true)).thenReturn(null); // store does not have any policies for that signature hash for (Action action : cu) { for (boolean isAdmin : new boolean[] { true, false }) { _failures.clear(); Assert.assertFalse(_validator.isValid(_policy, action, isAdmin, _failures)); @@ -684,7 +684,7 @@ public class TestRangerPolicyValidator { // { "resource-name", "values" "isExcludes", "isRecursive" } // values collection is null as it isn't relevant to the part being tested with this data { "db", null, null, true }, // null should be treated as false - { "tbl", null, false, false }, // set to false where def is null and def is true + { "tbl", null, false, false }, // set to false where def is null and def is true { "col", null, true, null} // set to null where def is false }; @@ -704,8 +704,8 @@ public class TestRangerPolicyValidator { private Object[][] policyResourceMap_failures = new Object[][] { // { "resource-name", "values" "isExcludes", "isRecursive" } // values collection is null as it isn't relevant to the part being tested with this data - { "db", null, true, true }, // ok: def has true for both - { "tbl", null, true, null }, // excludes: definition does not allow excludes by resource has it set to true + { "db", null, true, true }, // ok: def has true for both + { "tbl", null, true, null }, // excludes: definition does not allow excludes by resource has it set to true { "col", null, false, true } // recursive: def==null (i.e. false), policy==true }; @@ -715,7 +715,7 @@ public class TestRangerPolicyValidator { List<RangerResourceDef> resourceDefs = _utils.createResourceDefs(resourceDef_happyPath); Map<String, RangerPolicyResource> resourceMap = _utils.createPolicyResourceMap(policyResourceMap_failures); when(_serviceDef.getResources()).thenReturn(resourceDefs); - // should not error out on + // should not error out on Assert.assertFalse(_validator.isValidResourceFlags(resourceMap, _failures, resourceDefs, "a-service-def", "a-policy", false)); _utils.checkFailureForSemanticError(_failures, "isExcludes", "tbl"); _utils.checkFailureForSemanticError(_failures, "isRecursive", "col"); @@ -738,10 +738,10 @@ public class TestRangerPolicyValidator { Assert.assertTrue(_validator.isPolicyResourceUnique(_policy, _failures, action)); Assert.assertTrue(_validator.isPolicyResourceUnique(_policy, _failures, action)); } - /* + /* * If store has a policy with matching signature then the check should fail with appropriate error message. * - For create any match is a problem - * - Signature check can never fail for disabled policies! + * - Signature check can never fail for disabled policies! */ RangerPolicy policy1 = mock(RangerPolicy.class); policies.add(policy1); when(_store.getPoliciesByResourceSignature("service-name", hash, true)).thenReturn(policies); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefHelper.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefHelper.java b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefHelper.java index af158b0..ae42652 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefHelper.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefHelper.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 @@ -44,7 +44,7 @@ public class TestRangerServiceDefHelper { @Before public void before() { - _serviceDef = mock(RangerServiceDef.class); + _serviceDef = mock(RangerServiceDef.class); when(_serviceDef.getName()).thenReturn("a-service-def"); // wipe the cache clean RangerServiceDefHelper._Cache.clear(); @@ -54,19 +54,19 @@ public class TestRangerServiceDefHelper { public void test_getResourceHierarchies() { /* * Create a service-def with following resource graph - * + * * Database -> UDF * | * v * Table -> Column * | * v - * Table-Attribute - * + * Table-Attribute + * * It contains following hierarchies * - [ Database UDF] * - [ Database Table Column ] - * - [ Database Table Table-Attribute ] + * - [ Database Table Table-Attribute ] */ RangerResourceDef Database = createResourceDef("Database", ""); RangerResourceDef UDF = createResourceDef("UDF", "Database"); @@ -81,7 +81,7 @@ public class TestRangerServiceDefHelper { _helper = new RangerServiceDefHelper(_serviceDef); assertTrue(_helper.isResourceGraphValid()); Set<List<RangerResourceDef>> hierarchies = _helper.getResourceHierarchies(RangerPolicy.POLICY_TYPE_ACCESS); - // there should be + // there should be List<RangerResourceDef> hierarchy = Lists.newArrayList(Database, UDF); assertTrue(hierarchies.contains(hierarchy)); hierarchy = Lists.newArrayList(Database, Table, Column); @@ -97,7 +97,7 @@ public class TestRangerServiceDefHelper { * A --> B --> C * ^ | * | | - * |---- D <--- + * |---- D <--- */ RangerResourceDef A = createResourceDef("A", "D"); // A's parent is D, etc. RangerResourceDef B = createResourceDef("B", "C"); @@ -118,13 +118,13 @@ public class TestRangerServiceDefHelper { * | * v * Table -> Column - * + * * Namespace -> package * | * v * function - * - * Check that helper corrects reports back all of the hierarchies: levels in it and their order. + * + * Check that helper corrects reports back all of the hierarchies: levels in it and their order. */ RangerResourceDef database = createResourceDef("database", ""); RangerResourceDef tableSpace = createResourceDef("table-space", "database"); @@ -132,14 +132,14 @@ public class TestRangerServiceDefHelper { RangerResourceDef column = createResourceDef("column", "table"); RangerResourceDef namespace = createResourceDef("namespace", ""); RangerResourceDef function = createResourceDef("function", "namespace"); - RangerResourceDef Package = createResourceDef("package", "namespace"); + RangerResourceDef Package = createResourceDef("package", "namespace"); List<RangerResourceDef> resourceDefs = Lists.newArrayList(database, tableSpace, table, column, namespace, function, Package); when(_serviceDef.getResources()).thenReturn(resourceDefs); _helper = new RangerServiceDefHelper(_serviceDef); assertTrue(_helper.isResourceGraphValid()); Set<List<RangerResourceDef>> hierarchies = _helper.getResourceHierarchies(RangerPolicy.POLICY_TYPE_ACCESS); - Set<List<String>> expectedHierarchies = new HashSet<List<String>>(); + Set<List<String>> expectedHierarchies = new HashSet<List<String>>(); expectedHierarchies.add(Lists.newArrayList("database", "table-space")); expectedHierarchies.add(Lists.newArrayList("database", "table", "column")); expectedHierarchies.add(Lists.newArrayList("namespace", "package")); @@ -157,30 +157,30 @@ public class TestRangerServiceDefHelper { public final void test_isResourceGraphValid_forest_singleNodeTrees() { /* * Create a service-def which is a forest with a few single node trees - * + * * Database - * + * * Server - * + * * Namespace -> package * | * v * function - * - * Check that helper corrects reports back all of the hierarchies: levels in it and their order. + * + * Check that helper corrects reports back all of the hierarchies: levels in it and their order. */ RangerResourceDef database = createResourceDef("database", ""); RangerResourceDef server = createResourceDef("server", ""); RangerResourceDef namespace = createResourceDef("namespace", ""); RangerResourceDef function = createResourceDef("function", "namespace"); - RangerResourceDef Package = createResourceDef("package", "namespace"); + RangerResourceDef Package = createResourceDef("package", "namespace"); List<RangerResourceDef> resourceDefs = Lists.newArrayList(database, server, namespace, function, Package); when(_serviceDef.getResources()).thenReturn(resourceDefs); _helper = new RangerServiceDefHelper(_serviceDef); assertTrue(_helper.isResourceGraphValid()); Set<List<RangerResourceDef>> hierarchies = _helper.getResourceHierarchies(RangerPolicy.POLICY_TYPE_ACCESS); - Set<List<String>> expectedHierarchies = new HashSet<List<String>>(); + Set<List<String>> expectedHierarchies = new HashSet<List<String>>(); expectedHierarchies.add(Lists.newArrayList("database")); expectedHierarchies.add(Lists.newArrayList("server")); expectedHierarchies.add(Lists.newArrayList("namespace", "package")); @@ -222,7 +222,7 @@ public class TestRangerServiceDefHelper { when(_serviceDef.getUpdateTime()).thenReturn(getLastMonth()); _helper = new RangerServiceDefHelper(_serviceDef); assertTrue("Didn't get a delegate different than what was put in the cache", delegate != _helper._delegate); - // now that a new instance was added to the cache let's ensure that it got added to the cache + // now that a new instance was added to the cache let's ensure that it got added to the cache Delegate newDelegate = _helper._delegate; _helper = new RangerServiceDefHelper(_serviceDef); assertTrue("Didn't get a delegate different than what was put in the cache", newDelegate == _helper._delegate); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefValidator.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefValidator.java b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefValidator.java index 2ce8c03..33e6f4a 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefValidator.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceDefValidator.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 @@ -61,7 +61,7 @@ public class TestRangerServiceDefValidator { final Object[][] enums_good = new Object[][] { { 1L, "authentication-type", new String[] { "simple", "kerberos" } }, - { 2L, "time-unit", new String[] { "day", "hour", "minute" } }, + { 2L, "time-unit", new String[] { "day", "hour", "minute" } }, }; @Test @@ -78,7 +78,7 @@ public class TestRangerServiceDefValidator { @Test public final void testIsValid_Long_failures() throws Exception { Long id = null; - // passing in wrong action type + // passing in wrong action type boolean result = _validator.isValid((Long)null, Action.CREATE, _failures); assertFalse(result); _utils.checkFailureForInternalError(_failures); @@ -277,7 +277,7 @@ public class TestRangerServiceDefValidator { final Object[][] enums_bad_enumName_duplicate_differentCase = new Object[][] { // { id, enum-name, enum-values } - { 1L, "authentication-type", new String[] { "simple", "kerberos" } }, + { 1L, "authentication-type", new String[] { "simple", "kerberos" } }, { 1L, "time-unit", new String[] { "day", "hour", "minute" } }, { 1L, "Authentication-Type", new String[] { } },// duplicate enum-name different in case }; @@ -326,7 +326,7 @@ public class TestRangerServiceDefValidator { // add an element with same name as the first element String name = input.iterator().next().getName(); when(anEnumDef.getName()).thenReturn(name); - List<RangerEnumElementDef> elementDefs = _utils.createEnumElementDefs(new String[] {"val1", "val2"}); + List<RangerEnumElementDef> elementDefs = _utils.createEnumElementDefs(new String[] {"val1", "val2"}); when(anEnumDef.getElements()).thenReturn(elementDefs); input.add(anEnumDef); _failures.clear(); assertFalse(_validator.isValidEnums(input, _failures)); @@ -419,7 +419,7 @@ public class TestRangerServiceDefValidator { { "db", null, null, null, null, "" , 10 }, { "table", null, null, null, null, "db", 20 }, // same as db's level { "column-family", null, null, null, null, "table", null }, // level is null! - { "column", null, null, null, null, "column-family", 20 }, // level is duplicate for [db->table->column-family-> column] hierarchy + { "column", null, null, null, null, "column-family", 20 }, // level is duplicate for [db->table->column-family-> column] hierarchy { "udf", null, null, null, null, "db", 10 }, // udf's id conflicts with that of db in the [db->udf] hierarchy }; @@ -470,9 +470,9 @@ public class TestRangerServiceDefValidator { { null, null, "" }, // id and name both null, type is empty { 1L, "security", "blah" }, // bad type for service def { 1L, "port", "int" }, // duplicate id - { 2L, "security", "string" }, // duplicate name - { 3L, "timeout", "enum", "units", null }, // , sub-type (units) is not among known enum types - { 4L, "auth", "enum", "authentication-type", "dimple" }, // default value is not among known values for the enum (sub-type) + { 2L, "security", "string" }, // duplicate name + { 3L, "timeout", "enum", "units", null }, // , sub-type (units) is not among known enum types + { 4L, "auth", "enum", "authentication-type", "dimple" }, // default value is not among known values for the enum (sub-type) }; List<RangerServiceConfigDef> configs = _utils.createServiceDefConfigs(config_def_data_bad); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceValidator.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceValidator.java b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceValidator.java index c0f906b..40af3ce 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceValidator.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerServiceValidator.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 @@ -161,7 +161,7 @@ public class TestRangerServiceValidator { @Test public void test_isValid_happyPath() throws Exception { - // create a service def with some required parameters + // create a service def with some required parameters Object[][] serviceDefInput = new Object[][] { { "param1", true }, { "param2", true }, @@ -178,7 +178,7 @@ public class TestRangerServiceValidator { when(service.getType()).thenReturn("aType"); // contains an extra parameter (param6) and one optional is missing(param4) String[] configs = new String[] { "param1", "param2", "param3", "param5", "param6" }; - Map<String, String> configMap = _utils.createMap(configs); + Map<String, String> configMap = _utils.createMap(configs); when(service.getConfigs()).thenReturn(configMap); // wire then into the store // service does not exists http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerValidator.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerValidator.java b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerValidator.java index f189c21..5519a2c 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerValidator.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/TestRangerValidator.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,7 +79,7 @@ public class TestRangerValidator { @Test public void test_ctor_firewalling() { try { - // service store can't be null during construction + // service store can't be null during construction new RangerValidatorForTest(null); Assert.fail("Should have thrown exception!"); } catch (IllegalArgumentException e) { @@ -510,7 +510,7 @@ public class TestRangerValidator { String fieldName = "value-field-Name"; String collectionName = "value-collection-Name"; Set<String> alreadySeen = new HashSet<String>(); - // null/empty string value is invalid + // null/empty string value is invalid for (String value : new String[] { null, "", " " }) { Assert.assertFalse(_validator.isUnique(value, alreadySeen, fieldName, collectionName, _failures)); _utils.checkFailureForMissingValue(_failures, fieldName); @@ -537,7 +537,7 @@ public class TestRangerValidator { String collectionName = "field-collection-Name"; Set<Long> alreadySeen = new HashSet<Long>(); Long value = null; - // null value is invalid + // null value is invalid Assert.assertFalse(_validator.isUnique(value, alreadySeen, fieldName, collectionName, _failures)); _utils.checkFailureForMissingValue(_failures, fieldName); @@ -558,7 +558,7 @@ public class TestRangerValidator { String collectionName = "field-collection-Name"; Set<Integer> alreadySeen = new HashSet<Integer>(); Integer value = null; - // null value is invalid + // null value is invalid Assert.assertFalse(_validator.isUnique(value, alreadySeen, fieldName, collectionName, _failures)); _utils.checkFailureForMissingValue(_failures, fieldName); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/ValidationTestUtils.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/ValidationTestUtils.java b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/ValidationTestUtils.java index a59a159..5570ce5 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/ValidationTestUtils.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/model/validation/ValidationTestUtils.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 @@ -200,7 +200,7 @@ public class ValidationTestUtils { List<RangerPolicyItem> policyItems = new ArrayList<RangerPolicyItem>(); for (Object object : data) { @SuppressWarnings("unchecked") - Map<String, Object[]> map = (Map<String, Object[]>) object; + Map<String, Object[]> map = (Map<String, Object[]>) object; RangerPolicyItem policyItem = mock(RangerPolicyItem.class); List<String> usersList = null; @@ -222,7 +222,7 @@ public class ValidationTestUtils { accessesList = new ArrayList<RangerPolicyItemAccess>(); for (int i = 0; i < accesses.length; i++) { String access = accesses[i]; - Boolean isAllowed = isAllowedFlags[i]; + Boolean isAllowed = isAllowedFlags[i]; RangerPolicyItemAccess itemAccess = mock(RangerPolicyItemAccess.class); when(itemAccess.getType()).thenReturn(access); when(itemAccess.getIsAllowed()).thenReturn(isAllowed); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-common/src/test/java/org/apache/ranger/plugin/policyengine/TestPolicyDb.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/policyengine/TestPolicyDb.java b/agents-common/src/test/java/org/apache/ranger/plugin/policyengine/TestPolicyDb.java index f41dde4..097e6ff 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/policyengine/TestPolicyDb.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/policyengine/TestPolicyDb.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/agents-common/src/test/java/org/apache/ranger/plugin/policyengine/TestPolicyEngine.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/policyengine/TestPolicyEngine.java b/agents-common/src/test/java/org/apache/ranger/plugin/policyengine/TestPolicyEngine.java index 9937757..5bd0282 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/policyengine/TestPolicyEngine.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/policyengine/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/agents-common/src/test/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluatorTest.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluatorTest.java b/agents-common/src/test/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluatorTest.java index 9a3333c..769e205 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluatorTest.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/policyevaluator/RangerDefaultPolicyEvaluatorTest.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/agents-common/src/test/java/org/apache/ranger/plugin/resourcematcher/TestResourceMatcher.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/resourcematcher/TestResourceMatcher.java b/agents-common/src/test/java/org/apache/ranger/plugin/resourcematcher/TestResourceMatcher.java index 2cb8fde..39bd056 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/resourcematcher/TestResourceMatcher.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/resourcematcher/TestResourceMatcher.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/agents-common/src/test/java/org/apache/ranger/plugin/store/TestServiceStore.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/store/TestServiceStore.java b/agents-common/src/test/java/org/apache/ranger/plugin/store/TestServiceStore.java index 3575b29..077289a 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/store/TestServiceStore.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/store/TestServiceStore.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 @@ -55,7 +55,7 @@ public class TestServiceStore { file.delete() ; } - file.deleteOnExit(); + file.deleteOnExit(); file.mkdirs() ; http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-common/src/test/java/org/apache/ranger/plugin/store/TestTagStore.java ---------------------------------------------------------------------- diff --git a/agents-common/src/test/java/org/apache/ranger/plugin/store/TestTagStore.java b/agents-common/src/test/java/org/apache/ranger/plugin/store/TestTagStore.java index a24d32c..af09562 100644 --- a/agents-common/src/test/java/org/apache/ranger/plugin/store/TestTagStore.java +++ b/agents-common/src/test/java/org/apache/ranger/plugin/store/TestTagStore.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/agents-cred/src/main/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProvider.java ---------------------------------------------------------------------- diff --git a/agents-cred/src/main/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProvider.java b/agents-cred/src/main/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProvider.java index 6ac702a..a61d81b 100644 --- a/agents-cred/src/main/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProvider.java +++ b/agents-cred/src/main/java/org/apache/ranger/authorization/hadoop/utils/RangerCredentialProvider.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 @@ -32,19 +32,19 @@ public final class RangerCredentialProvider { private static Log LOG = LogFactory.getLog(RangerCredentialProvider.class); - private static final RangerCredentialProvider CRED_PROVIDER = new RangerCredentialProvider(); - + private static final RangerCredentialProvider CRED_PROVIDER = new RangerCredentialProvider(); + protected RangerCredentialProvider() { - // + // } - + public static RangerCredentialProvider getInstance() { return CRED_PROVIDER; } - + public char[] getCredentialString(String url, String alias) { - List<CredentialProvider> providers = getCredentialProviders(url); - + List<CredentialProvider> providers = getCredentialProviders(url); + if(providers != null) { for( CredentialProvider provider: providers) { try { @@ -54,23 +54,23 @@ public final class RangerCredentialProvider { return credEntry.getCredential(); } } catch(Exception ie) { - LOG.error("Unable to get the Credential Provider from the Configuration", ie); + LOG.error("Unable to get the Credential Provider from the Configuration", ie); } } } return null; } - + List<CredentialProvider> getCredentialProviders(String url){ try { Configuration conf = new Configuration(); conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, url); - return CredentialProviderFactory.getProviders(conf); + return CredentialProviderFactory.getProviders(conf); } catch(Exception ie) { LOG.error("Unable to get the Credential Provider from the Configuration", ie); - } + } return null; } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/agents-installer/src/main/java/org/apache/ranger/utils/install/XmlConfigChanger.java ---------------------------------------------------------------------- diff --git a/agents-installer/src/main/java/org/apache/ranger/utils/install/XmlConfigChanger.java b/agents-installer/src/main/java/org/apache/ranger/utils/install/XmlConfigChanger.java index dd26dc2..1d56bea 100644 --- a/agents-installer/src/main/java/org/apache/ranger/utils/install/XmlConfigChanger.java +++ b/agents-installer/src/main/java/org/apache/ranger/utils/install/XmlConfigChanger.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 @@ -75,7 +75,7 @@ public class XmlConfigChanger { XmlConfigChanger xmlConfigChanger = new XmlConfigChanger() ; xmlConfigChanger.parseConfig(args); try { - xmlConfigChanger.run(); + xmlConfigChanger.run(); } catch(Throwable t) { System.err.println("*************************************************************************") ; @@ -288,7 +288,7 @@ public class XmlConfigChanger { FileOutputStream out = new FileOutputStream(outFile) ; StreamResult result = new StreamResult(out) ; transformer.transform(source, result); - out.close(); + out.close(); } finally { @@ -364,7 +364,7 @@ public class XmlConfigChanger { if (cnl.item(j).hasChildNodes()) { valueNode = cnl.item(j).getChildNodes().item(0) ; } - if (valueNode == null) { // Value Node is defined with + if (valueNode == null) { // Value Node is defined with ret = "" ; } else { @@ -403,7 +403,7 @@ public class XmlConfigChanger { if (nodeName.equals(NAME_NODE_NAME)) { String pName = cnl.item(j).getChildNodes().item(0).getNodeValue() ; found = pName.equals(propName) ; - if (found) + if (found) break ; } } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/credentialbuilder/src/main/java/org/apache/ranger/credentialapi/CredentialReader.java ---------------------------------------------------------------------- diff --git a/credentialbuilder/src/main/java/org/apache/ranger/credentialapi/CredentialReader.java b/credentialbuilder/src/main/java/org/apache/ranger/credentialapi/CredentialReader.java index ecede34..94e6afd 100644 --- a/credentialbuilder/src/main/java/org/apache/ranger/credentialapi/CredentialReader.java +++ b/credentialbuilder/src/main/java/org/apache/ranger/credentialapi/CredentialReader.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 @@ -33,7 +33,7 @@ public class CredentialReader { try{ if(CrendentialProviderPath==null || alias==null){ return null; - } + } char[] pass = null; Configuration conf = new Configuration(); String crendentialProviderPrefixJceks=JavaKeyStoreProvider.SCHEME_NAME + "://file"; @@ -69,7 +69,7 @@ public class CredentialReader { if(pass!=null && pass.length>0){ credential=String.valueOf(pass); break; - } + } } } }catch(Exception ex){ @@ -78,10 +78,10 @@ public class CredentialReader { } return credential; } - + /* public static void main(String args[]) throws Exception{ - String keystoreFile =new String("/tmp/mykey3.jceks"); + String keystoreFile =new String("/tmp/mykey3.jceks"); String password=CredentialReader.getDecryptedString(keystoreFile, "mykey3"); System.out.println(password); }*/ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/credentialbuilder/src/main/java/org/apache/ranger/credentialapi/buildks.java ---------------------------------------------------------------------- diff --git a/credentialbuilder/src/main/java/org/apache/ranger/credentialapi/buildks.java b/credentialbuilder/src/main/java/org/apache/ranger/credentialapi/buildks.java index d8ffe2c..ed7a1fa 100644 --- a/credentialbuilder/src/main/java/org/apache/ranger/credentialapi/buildks.java +++ b/credentialbuilder/src/main/java/org/apache/ranger/credentialapi/buildks.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 @@ -84,7 +84,7 @@ public class buildks { return returnCode; } tempCredential=CredentialReader.getDecryptedString(providerPath, alias); - }else{ + }else{ return returnCode; } @@ -134,7 +134,7 @@ public class buildks { return returnCode; } displayCommand(args); - }else{ + }else{ return returnCode; } @@ -159,7 +159,7 @@ public class buildks { ex.printStackTrace(); } catch(Exception ex){ ex.printStackTrace(); - } + } return returnCode; } public int createCredentialFromUserInput(){ @@ -217,7 +217,7 @@ public class buildks { ex.printStackTrace(); } catch(Exception ex){ ex.printStackTrace(); - } + } return returnCode; } @@ -237,7 +237,7 @@ public class buildks { } //display command which need to be executed or entered displayCommand(args); - }else{ + }else{ return returnCode; } CredentialShell cs = new CredentialShell(); @@ -256,7 +256,7 @@ public class buildks { ex.printStackTrace(); } catch(Exception ex){ ex.printStackTrace(); - } + } return returnCode; } @@ -279,7 +279,7 @@ public class buildks { //display command which need to be executed or entered displayCommand(args); - }else{ + }else{ return returnCode; } CredentialShell cs = new CredentialShell(); @@ -298,7 +298,7 @@ public class buildks { ex.printStackTrace(); } catch(Exception ex){ ex.printStackTrace(); - } + } return returnCode; } @@ -495,7 +495,7 @@ public class buildks { } return isValid; } - + private static boolean isCredentialShellInteractiveEnabled() { boolean ret = false ; http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/credentialbuilder/src/test/java/org/apache/ranger/credentialapi/TestCredentialReader.java ---------------------------------------------------------------------- diff --git a/credentialbuilder/src/test/java/org/apache/ranger/credentialapi/TestCredentialReader.java b/credentialbuilder/src/test/java/org/apache/ranger/credentialapi/TestCredentialReader.java index f20a7b4..4c2e86e 100644 --- a/credentialbuilder/src/test/java/org/apache/ranger/credentialapi/TestCredentialReader.java +++ b/credentialbuilder/src/test/java/org/apache/ranger/credentialapi/TestCredentialReader.java @@ -28,12 +28,12 @@ import org.junit.Test; public class TestCredentialReader { private final String keystoreFile = new File(System.getProperty("user.home")+"/testkeystore.jceks").toURI().getPath(); @Before - public void setup() throws Exception { + public void setup() throws Exception { buildks buildksOBJ=new buildks(); String[] argsCreateCommand = {"create", "TestCredential2", "-value", "PassworD123", "-provider", "jceks://file@/" + keystoreFile}; - int rc2=buildksOBJ.createCredential(argsCreateCommand); + int rc2=buildksOBJ.createCredential(argsCreateCommand); assertEquals( 0, rc2); - assertTrue(rc2==0); + assertTrue(rc2==0); } @Test @@ -42,12 +42,12 @@ public class TestCredentialReader { assertEquals( "PassworD123", password); assertTrue(password,"PassworD123".equals(password)); //delete after use - + String[] argsdeleteCommand = new String[] {"delete", "TestCredential2", "-provider", "jceks://file@/" + keystoreFile}; - + buildks buildksOBJ=new buildks(); buildksOBJ.deleteCredential(argsdeleteCommand, true); - + } - + } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/credentialbuilder/src/test/java/org/apache/ranger/credentialapi/Testbuildks.java ---------------------------------------------------------------------- diff --git a/credentialbuilder/src/test/java/org/apache/ranger/credentialapi/Testbuildks.java b/credentialbuilder/src/test/java/org/apache/ranger/credentialapi/Testbuildks.java index 8379f83..5386838 100644 --- a/credentialbuilder/src/test/java/org/apache/ranger/credentialapi/Testbuildks.java +++ b/credentialbuilder/src/test/java/org/apache/ranger/credentialapi/Testbuildks.java @@ -26,18 +26,18 @@ import org.junit.Test; public class Testbuildks { private final String keystoreFile = new File(System.getProperty("user.home")+"/testkeystore.jceks").toURI().getPath(); @Test - public void testBuildKSsuccess() throws Exception { + public void testBuildKSsuccess() throws Exception { buildks buildksOBJ=new buildks(); String[] argsCreateCommand = {"create", "TestCredential1", "-value", "PassworD123", "-provider", "jceks://file@/" + keystoreFile}; - int rc1=buildksOBJ.createCredential(argsCreateCommand); + int rc1=buildksOBJ.createCredential(argsCreateCommand); assertEquals( 0, rc1); assertTrue(rc1==0); - + String[] argsListCommand = {"list", "-provider","jceks://file@/" + keystoreFile}; int rc2=buildksOBJ.listCredential(argsListCommand); assertEquals(0, rc2); assertTrue(rc2==0); - + String[] argsGetCommand = {"get", "TestCredential1", "-provider", "jceks://file@/" +keystoreFile }; String pw=buildksOBJ.getCredential(argsGetCommand); assertEquals("PassworD123", pw); @@ -50,7 +50,7 @@ public class Testbuildks { int rc3=buildksOBJ.deleteCredential(argsDeleteCommand, isSilentMode); assertEquals(0, rc3); assertTrue(rc3==0); - + if(rc1==rc2 && rc2==rc3 && rc3==0 && getCredentialPassed){ System.out.println("Test Case has been completed successfully.."); } @@ -58,24 +58,24 @@ public class Testbuildks { @Test public void testInvalidProvider() throws Exception { - buildks buildksOBJ=new buildks(); - String[] argsCreateCommand = {"create", "TestCredential1", "-value", "PassworD123", "-provider", "jksp://file@/"+keystoreFile}; - int rc1=buildksOBJ.createCredential(argsCreateCommand); + buildks buildksOBJ=new buildks(); + String[] argsCreateCommand = {"create", "TestCredential1", "-value", "PassworD123", "-provider", "jksp://file@/"+keystoreFile}; + int rc1=buildksOBJ.createCredential(argsCreateCommand); assertEquals(-1, rc1); assertTrue(rc1==-1); - } - + } + @Test public void testInvalidCommand() throws Exception { - buildks buildksOBJ=new buildks(); - String[] argsCreateCommand = {"creat", "TestCredential1", "-value", "PassworD123", "-provider", "jksp://file@/"+keystoreFile}; - int rc1=buildksOBJ.createCredential(argsCreateCommand); + buildks buildksOBJ=new buildks(); + String[] argsCreateCommand = {"creat", "TestCredential1", "-value", "PassworD123", "-provider", "jksp://file@/"+keystoreFile}; + int rc1=buildksOBJ.createCredential(argsCreateCommand); assertEquals(-1, rc1); assertTrue(rc1==-1); - } + } /*public static void main(String args[]) throws Exception{ Testbuildks tTestbuildks=new Testbuildks(); tTestbuildks.testBuildKSsuccess(); - }*/ - + }*/ + } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java ---------------------------------------------------------------------- diff --git a/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java index a74f8d1..aec41f5 100644 --- a/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.java +++ b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/EmbeddedServer.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 @@ -132,7 +132,7 @@ public class EmbeddedServer { String enabledProtocols = "SSLv2Hello, TLSv1, TLSv1.1, TLSv1.2"; ssl.setAttribute("sslEnabledProtocols", enabledProtocols); - server.getService().addConnector(ssl); + server.getService().addConnector(ssl); // // Making this as a default connector @@ -251,29 +251,29 @@ public class EmbeddedServer { e.printStackTrace(); } }else{ - try{ - server.start(); + try{ + server.start(); server.getServer().await(); shutdownServer(); } catch (LifecycleException e) { LOG.severe("Tomcat Server failed to start:" + e.toString()); - e.printStackTrace(); + e.printStackTrace(); } catch (Exception e) { LOG.severe("Tomcat Server failed to start:" + e.toString()); - e.printStackTrace(); + e.printStackTrace(); } } }else{ - try{ - server.start(); + try{ + server.start(); server.getServer().await(); shutdownServer(); } catch (LifecycleException e) { LOG.severe("Tomcat Server failed to start:" + e.toString()); - e.printStackTrace(); + e.printStackTrace(); } catch (Exception e) { LOG.severe("Tomcat Server failed to start:" + e.toString()); - e.printStackTrace(); + e.printStackTrace(); } } } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbeddedServer.java ---------------------------------------------------------------------- diff --git a/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbeddedServer.java b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbeddedServer.java index ef80f43..fa30598 100644 --- a/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbeddedServer.java +++ b/embeddedwebserver/src/main/java/org/apache/ranger/server/tomcat/StopEmbeddedServer.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 @@ -47,7 +47,7 @@ public class StopEmbeddedServer extends EmbeddedServer { out.println(shutdownCommand) ; - out.flush(); + out.flush(); out.close(); } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/AuthorizationSession.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/AuthorizationSession.java b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/AuthorizationSession.java index 48b1b11..e49405d 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/AuthorizationSession.java +++ b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/AuthorizationSession.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 @@ -85,7 +85,7 @@ public class AuthorizationSession { } AuthorizationSession access(String anAccess) { - _access = anAccess; + _access = anAccess; return this; } @@ -229,7 +229,7 @@ public class AuthorizationSession { if (_auditHandler != null) { List<AuthzAuditEvent> events = null; /* - * What we log to audit depends on authorization status. For success we log all accumulated events. In case of failure + * What we log to audit depends on authorization status. For success we log all accumulated events. In case of failure * we log just the last set of audit messages as we only need to record the cause of overall denial. */ if (authorized) { http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/ColumnIterator.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/ColumnIterator.java b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/ColumnIterator.java index 533a1c1..ccccb4e 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/ColumnIterator.java +++ b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/ColumnIterator.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/main/java/org/apache/ranger/authorization/hbase/HbaseAuditHandler.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuditHandler.java b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuditHandler.java index c77dc20..1344e29 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuditHandler.java +++ b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuditHandler.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 @@ -32,9 +32,9 @@ public interface HbaseAuditHandler extends RangerAccessResultProcessor { /** * Discards and returns the last audit events captured by the audit handler. Last audit event should be the ones generated during the most recent authorization request. - * However, it won't be all of the audit events called during an authorize call since implementation class may not override the method which takes a list of responses -- in + * However, it won't be all of the audit events called during an authorize call since implementation class may not override the method which takes a list of responses -- in * which case there would be several audit messages generated by one call but this only allows you to get last of those messages created during single auth request. - * After this call the last set of audit events won't be returned by <code>getCapturedEvents</code>. + * After this call the last set of audit events won't be returned by <code>getCapturedEvents</code>. * @return */ AuthzAuditEvent getAndDiscardMostRecentEvent(); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuditHandlerImpl.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuditHandlerImpl.java b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuditHandlerImpl.java index 6fbf5fc..845cd51 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuditHandlerImpl.java +++ b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuditHandlerImpl.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/main/java/org/apache/ranger/authorization/hbase/HbaseAuthUtils.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuthUtils.java b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuthUtils.java index 58f59bb..f8ee168 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuthUtils.java +++ b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuthUtils.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/main/java/org/apache/ranger/authorization/hbase/HbaseAuthUtilsImpl.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuthUtilsImpl.java b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuthUtilsImpl.java index d80a04a..32d08fb 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuthUtilsImpl.java +++ b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseAuthUtilsImpl.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/main/java/org/apache/ranger/authorization/hbase/HbaseFactory.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseFactory.java b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseFactory.java index 3488d70..1322e0f 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseFactory.java +++ b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseFactory.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 @@ -29,7 +29,7 @@ public class HbaseFactory { static final HbaseAuthUtils _AuthUtils = new HbaseAuthUtilsImpl(); static final HbaseFactory _Factory = new HbaseFactory(); /** - * This is a singleton + * This is a singleton */ private HbaseFactory() { // TODO remove this clutch to enforce singleton by moving to a DI framework http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseUserUtils.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseUserUtils.java b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseUserUtils.java index 05d67d6..e2f1efd 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseUserUtils.java +++ b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseUserUtils.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 @@ -38,7 +38,7 @@ public interface HbaseUserUtils { Set<String> getUserGroups(User user); /** - * May return null in case of an error + * May return null in case of an error * @return */ User getUser(); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseUserUtilsImpl.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseUserUtilsImpl.java b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseUserUtilsImpl.java index ddc84d8..23cd5fc 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseUserUtilsImpl.java +++ b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/HbaseUserUtilsImpl.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 @@ -36,7 +36,7 @@ public class HbaseUserUtilsImpl implements HbaseUserUtils { private static final Log LOG = LogFactory.getLog(HbaseUserUtilsImpl.class.getName()); private static final String SUPERUSER_CONFIG_PROP = "hbase.superuser"; - // only to detect problems with initialization order, not for thread-safety. + // only to detect problems with initialization order, not for thread-safety. static final AtomicBoolean _Initialized = new AtomicBoolean(false); // should never be null static final AtomicReference<Set<String>> _SuperUsers = new AtomicReference<Set<String>>(new HashSet<String>()); http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java index ac5f1e4..a422960 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java +++ b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.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 RangerAuthorizationCoprocessor extends RangerAuthorizationCoprocess final HbaseAuthUtils _authUtils = _factory.getAuthUtils(); private static volatile RangerHBasePlugin hbasePlugin = null; - // Utilities Methods + // Utilities Methods protected byte[] getTableName(RegionCoprocessorEnvironment e) { Region region = e.getRegion(); byte[] tableName = null; @@ -163,7 +163,7 @@ public class RangerAuthorizationCoprocessor extends RangerAuthorizationCoprocess return isSpecialTable(Bytes.toString(tableName)); } protected boolean isSpecialTable(String input) { - final String[] specialTables = new String[] { "hbase:meta", "-ROOT-", ".META."}; + final String[] specialTables = new String[] { "hbase:meta", "-ROOT-", ".META."}; for (String specialTable : specialTables ) { if (specialTable.equals(input)) { return true; @@ -208,7 +208,7 @@ public class RangerAuthorizationCoprocessor extends RangerAuthorizationCoprocess return strAddr; } - // Methods that are used within the CoProcessor + // Methods that are used within the CoProcessor private void requireScannerOwner(InternalScanner s) throws AccessDeniedException { if (!RpcServer.isInRpcCallContext()) { return; @@ -292,7 +292,7 @@ public class RangerAuthorizationCoprocessor extends RangerAuthorizationCoprocess } } - ColumnFamilyAccessResult evaluateAccess(String operation, Action action, final RegionCoprocessorEnvironment env, + ColumnFamilyAccessResult evaluateAccess(String operation, Action action, final RegionCoprocessorEnvironment env, final Map<byte[], ? extends Collection<?>> familyMap) throws AccessDeniedException { String access = _authUtils.getAccess(action); @@ -326,7 +326,7 @@ public class RangerAuthorizationCoprocessor extends RangerAuthorizationCoprocess } // let's create a session that would be reused. Set things on it that won't change. - HbaseAuditHandler auditHandler = _factory.getAuditHandler(); + HbaseAuditHandler auditHandler = _factory.getAuditHandler(); AuthorizationSession session = new AuthorizationSession(hbasePlugin) .operation(operation) .remoteAddress(getRemoteAddress()) @@ -354,7 +354,7 @@ public class RangerAuthorizationCoprocessor extends RangerAuthorizationCoprocess AuthzAuditEvent event = auditHandler.getAndDiscardMostRecentEvent(); // this could be null, of course, depending on audit settings of table. // if authorized then pass captured events as access allowed set else as access denied set. - result = new ColumnFamilyAccessResult(authorized, authorized, + result = new ColumnFamilyAccessResult(authorized, authorized, authorized ? Collections.singletonList(event) : null, null, authorized ? null : event, reason, null); if (LOG.isDebugEnabled()) { @@ -525,7 +525,7 @@ public class RangerAuthorizationCoprocessor extends RangerAuthorizationCoprocess return combinedFilter; } - void requirePermission(final String operation, final Action action, final RegionCoprocessorEnvironment regionServerEnv, final Map<byte[], ? extends Collection<?>> familyMap) + void requirePermission(final String operation, final Action action, final RegionCoprocessorEnvironment regionServerEnv, final Map<byte[], ? extends Collection<?>> familyMap) throws AccessDeniedException { ColumnFamilyAccessResult accessResult = evaluateAccess(operation, action, regionServerEnv, familyMap); @@ -550,7 +550,7 @@ public class RangerAuthorizationCoprocessor extends RangerAuthorizationCoprocess * @param columnFamily * @param column * @return - * @throws AccessDeniedException + * @throws AccessDeniedException */ void authorizeAccess(String operation, String otherInformation, Action action, String table, String columnFamily, String column) throws AccessDeniedException { @@ -571,7 +571,7 @@ public class RangerAuthorizationCoprocessor extends RangerAuthorizationCoprocess } User user = getActiveUser(); - HbaseAuditHandler auditHandler = _factory.getAuditHandler(); + HbaseAuditHandler auditHandler = _factory.getAuditHandler(); AuthorizationSession session = new AuthorizationSession(hbasePlugin) .operation(operation) .otherInformation(otherInformation) @@ -595,13 +595,13 @@ public class RangerAuthorizationCoprocessor extends RangerAuthorizationCoprocess session.publishResults(); } - boolean canSkipAccessCheck(final String operation, String access, final String table) + boolean canSkipAccessCheck(final String operation, String access, final String table) throws AccessDeniedException { User user = getActiveUser(); boolean result = false; if (user == null) { - String message = "Unexpeceted: User is null: access denied, not audited!"; + String message = "Unexpeceted: User is null: access denied, not audited!"; LOG.warn("canSkipAccessCheck: exiting" + message); throw new AccessDeniedException("No user associated with request (" + operation + ") for action: " + access + "on table:" + table); } else if (isAccessForMetadataRead(access, table)) { http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessorBase.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessorBase.java b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessorBase.java index 06500f2..f34bc12 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessorBase.java +++ b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessorBase.java @@ -57,7 +57,7 @@ import org.apache.hadoop.hbase.replication.ReplicationEndpoint; /** - * This class exists only to prevent the clutter of methods that we don't intend to implement in the main co-processor class. + * This class exists only to prevent the clutter of methods that we don't intend to implement in the main co-processor class. * @author alal * */ http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/09700f35/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationFilter.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationFilter.java b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationFilter.java index e281099..0254100 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationFilter.java +++ b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationFilter.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/main/java/org/apache/ranger/services/hbase/RangerServiceHBase.java ---------------------------------------------------------------------- diff --git a/hbase-agent/src/main/java/org/apache/ranger/services/hbase/RangerServiceHBase.java b/hbase-agent/src/main/java/org/apache/ranger/services/hbase/RangerServiceHBase.java index e5031af..7d5bf9b 100644 --- a/hbase-agent/src/main/java/org/apache/ranger/services/hbase/RangerServiceHBase.java +++ b/hbase-agent/src/main/java/org/apache/ranger/services/hbase/RangerServiceHBase.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