You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by su...@apache.org on 2017/02/25 07:18:15 UTC
[22/29] drill git commit: DRILL-4280: HYGIENE
DRILL-4280: HYGIENE
+ Do not recreate DrillConfig object in PamUserAuthenticator
+ Add new factory method to CaseInsensitiveMap
+ Clean documentation
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/f445b081
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/f445b081
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/f445b081
Branch: refs/heads/master
Commit: f445b08149163df465bc851b79d194fcc38ff2b2
Parents: d732aad
Author: Sudheesh Katkam <su...@apache.org>
Authored: Wed Jan 25 18:52:28 2017 -0800
Committer: Sudheesh Katkam <su...@apache.org>
Committed: Fri Feb 24 19:01:42 2017 -0800
----------------------------------------------------------------------
.../apache/drill/common/map/CaseInsensitiveMap.java | 14 +++++++++++++-
.../rpc/user/security/PamUserAuthenticator.java | 4 ++--
.../rpc/user/security/UserAuthenticatorFactory.java | 16 +++++++++-------
3 files changed, 24 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/f445b081/common/src/main/java/org/apache/drill/common/map/CaseInsensitiveMap.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/map/CaseInsensitiveMap.java b/common/src/main/java/org/apache/drill/common/map/CaseInsensitiveMap.java
index e96a20d..20e46dd 100644
--- a/common/src/main/java/org/apache/drill/common/map/CaseInsensitiveMap.java
+++ b/common/src/main/java/org/apache/drill/common/map/CaseInsensitiveMap.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -55,6 +55,18 @@ public class CaseInsensitiveMap<VALUE> implements Map<String, VALUE> {
}
/**
+ * Returns a new instance of {@link java.util.HashMap}, with key case-insensitivity, of expected size.
+ * See {@link java.util.HashMap}.
+ *
+ * @param expectedSize expected size
+ * @param <VALUE> type of values to be stored in the map
+ * @return key case-insensitive hash map
+ */
+ public static <VALUE> CaseInsensitiveMap<VALUE> newHashMapWithExpectedSize(final int expectedSize) {
+ return new CaseInsensitiveMap<>(Maps.<String, VALUE>newHashMapWithExpectedSize(expectedSize));
+ }
+
+ /**
* Returns a new instance of {@link ImmutableMap} with key case-insensitivity. This map is built from the given
* map. See {@link ImmutableMap}.
*
http://git-wip-us.apache.org/repos/asf/drill/blob/f445b081/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/security/PamUserAuthenticator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/security/PamUserAuthenticator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/security/PamUserAuthenticator.java
index 2928bfb..492b140 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/security/PamUserAuthenticator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/security/PamUserAuthenticator.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -39,7 +39,7 @@ public class PamUserAuthenticator implements UserAuthenticator {
@Override
public void setup(DrillConfig drillConfig) throws DrillbitStartupException {
- profiles = DrillConfig.create().getStringList(ExecConstants.PAM_AUTHENTICATOR_PROFILES);
+ profiles = drillConfig.getStringList(ExecConstants.PAM_AUTHENTICATOR_PROFILES);
// Create a JPAM object so that it triggers loading of native "jpamlib" needed. Issues in loading/finding native
// "jpamlib" will be found it Drillbit start rather than when authenticating the first user.
http://git-wip-us.apache.org/repos/asf/drill/blob/f445b081/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/security/UserAuthenticatorFactory.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/security/UserAuthenticatorFactory.java b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/security/UserAuthenticatorFactory.java
index d9aa276..c7a1338 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/security/UserAuthenticatorFactory.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/security/UserAuthenticatorFactory.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -29,23 +29,23 @@ import org.apache.drill.exec.exception.DrillbitStartupException;
import com.google.common.base.Strings;
/**
- * Factory class which provides {@link org.apache.drill.exec.rpc.user.security.UserAuthenticator} implementation
- * based on the BOOT options.
+ * Factory class which provides {@link UserAuthenticator} implementation based on the BOOT options.
*/
public class UserAuthenticatorFactory {
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(UserAuthenticatorFactory.class);
/**
- * Create a {@link org.apache.drill.exec.rpc.user.security.UserAuthenticator} implementation based on BOOT settings in
+ * Create a {@link UserAuthenticator} implementation based on BOOT settings in
* given <i>drillConfig</i>.
*
* @param config DrillConfig containing BOOT options.
- * @return Initialized {@link org.apache.drill.exec.rpc.user.security.UserAuthenticator} implementation instance.
+ * @return Initialized {@link UserAuthenticator} implementation instance.
* It is responsibility of the caller to close the authenticator when no longer needed.
*
* @throws DrillbitStartupException when no implementation found for given BOOT options.
*/
- public static UserAuthenticator createAuthenticator(final DrillConfig config, ScanResult scan) throws DrillbitStartupException {
+ public static UserAuthenticator createAuthenticator(final DrillConfig config, ScanResult scan)
+ throws DrillbitStartupException {
final String authImplConfigured = config.getString(USER_AUTHENTICATOR_IMPL);
if (Strings.isNullOrEmpty(authImplConfigured)) {
@@ -55,11 +55,13 @@ public class UserAuthenticatorFactory {
final Collection<Class<? extends UserAuthenticator>> authImpls =
scan.getImplementations(UserAuthenticator.class);
+ logger.debug("Found UserAuthenticator implementations: {}", authImpls);
for(Class<? extends UserAuthenticator> clazz : authImpls) {
final UserAuthenticatorTemplate template = clazz.getAnnotation(UserAuthenticatorTemplate.class);
if (template == null) {
- logger.warn("{} doesn't have {} annotation. Skipping.", clazz.getCanonicalName(), UserAuthenticatorTemplate.class);
+ logger.warn("{} doesn't have {} annotation. Skipping.", clazz.getCanonicalName(),
+ UserAuthenticatorTemplate.class);
continue;
}