1 /***********************************************************************
2  * Copyright (c) 2013-2025 General Atomics Integrated Intelligence, Inc.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Apache License, Version 2.0
5  * which accompanies this distribution and is available at
6  * https://www.apache.org/licenses/LICENSE-2.0
7  ***********************************************************************/
8 
9 package org.locationtech.geomesa.hbase.data
10 
11 import com.github.benmanes.caffeine.cache.{CacheLoader, Caffeine, LoadingCache}
12 import com.typesafe.scalalogging.LazyLogging
13 import org.apache.hadoop.conf.Configuration
14 import org.apache.hadoop.hbase.client.{Connection, ConnectionFactory}
15 import org.apache.hadoop.hbase.security.User
16 import org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier
17 import org.apache.hadoop.hbase.{HBaseConfiguration, HConstants}
18 import org.apache.hadoop.security.authentication.util.KerberosUtil
19 import org.apache.hadoop.security.{SecurityUtil, UserGroupInformation}
20 import org.locationtech.geomesa.hbase.HBaseSystemProperties
21 import org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.{HBaseGeoMesaKeyTab, HBaseGeoMesaPrincipal}
22 import org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.{ConfigPathsParam, ConfigsParam, ConnectionParam, ZookeeperParam}
23 import org.locationtech.geomesa.hbase.utils.HBaseVersions
24 import org.locationtech.geomesa.utils.hadoop.HadoopUtils
25 import org.locationtech.geomesa.utils.io.CloseWithLogging
26 
27 import java.io.{ByteArrayInputStream, Closeable}
28 import java.nio.charset.StandardCharsets
29 import java.security.PrivilegedExceptionAction
30 import scala.util.{Failure, Success, Try}
31 
32 object HBaseConnectionPool extends LazyLogging {
33 
34   import scala.collection.JavaConverters._
35 
36   private val configs: LoadingCache[ConfigKey, Configuration] = Caffeine.newBuilder().build(
37     new CacheLoader[ConfigKey, Configuration] {
38 
39       // add common resources from system property - lazy to allow object initialization if there's an error
40       private lazy val configuration = {
41         val base = HBaseConfiguration.create()
42         HBaseSystemProperties.ConfigPathProperty.option.foreach(addResources(base, _))
43         base
44       }
45 
46       override def load(key: ConfigKey): Configuration = {
47         val conf = new Configuration(configuration)
48         // Make sure that current user is always logged-in user
49         conf.set("hbase.client.userprovider.class", "org.locationtech.geomesa.hbase.data.LoginUserProvider")
50         // add the explicit props first, they may be needed for loading the path resources
51         key.xml.foreach(xml => conf.addResource(new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8))))
52         key.paths.foreach(addResources(conf, _))
53         key.zookeepers.foreach(zk => conf.set(HConstants.ZOOKEEPER_QUORUM, zk))
54         if (key.zookeepers.isEmpty && conf.get(HConstants.ZOOKEEPER_QUORUM) == "localhost") {
55           logger.warn("HBase connection is set to localhost - " +
56               "this may indicate that 'hbase-site.xml' is not on the classpath")
57         }
58         conf
59       }
60 
61       private def addResources(conf: Configuration, paths: String): Unit =
62         paths.split(',').map(_.trim).filterNot(_.isEmpty).foreach(HadoopUtils.addResource(conf, _))
63     }
64   )
65 
66   private val connections: LoadingCache[(Configuration, Boolean), CachedConnection] =  Caffeine.newBuilder().build(
67     new CacheLoader[(Configuration, Boolean), CachedConnection] {
68       override def load(key: (Configuration, Boolean)): CachedConnection = {
69         createConnection(key._1, key._2) match {
70           case SingletonConnection(connection, kerberos) => CachedConnection(connection, kerberos)
71           case c => throw new UnsupportedOperationException(s"Expected SingletonConnection but got $c")
72         }
73       }
74     }
75   )
76 
77   Runtime.getRuntime.addShutdownHook(new Thread() {
78     override def run(): Unit =
79       CloseWithLogging(connections.asMap().values().asScala.flatMap { case CachedConnection(c, k) => Seq(c) ++ k })
80   })
81 
82   /**
83    * Get (or create) a cached configuration
84    *
85    * @param params data store params
86    * @return
87    */
88   def getConfiguration(params: java.util.Map[String, _]): Configuration = {
89     val zk = ZookeeperParam.lookupOpt(params)
90     val paths = ConfigPathsParam.lookupOpt(params)
91     val xml = ConfigsParam.lookupOpt(params)
92     configs.get(ConfigKey(zk, paths, xml))
93   }
94 
95   /**
96    * Get (or create) a cached connection
97    *
98    * @param params data store params
99    * @param validate validate the connection after creation, or not
100    * @return
101    */
102   def getConnection(params: java.util.Map[String, _], validate: Boolean): ConnectionWrapper = {
103     if (ConnectionParam.exists(params)) {
104       ProvidedConnection(ConnectionParam.lookup(params))
105     } else {
106       val conf = getConfiguration(params)
107       logger.debug(s"Connecting to HBase instance at ${conf.get(HConstants.ZOOKEEPER_QUORUM)}")
108       if (HBaseDataStoreParams.CacheConnectionsParam.lookup(params)) {
109         connections.get((conf, validate))
110       } else {
111         createConnection(conf, validate)
112       }
113     }
114   }
115 
116   /**
117    * Create a new connection (not pooled)
118    *
119    * @param conf hbase configuration
120    * @param validate validate the connection after creation, or not
121    * @return
122    */
123   def createConnection(conf: Configuration, validate: Boolean): ConnectionWrapper = {
124     if (User.isHBaseSecurityEnabled(conf)) {
125       configureSecurity(conf)
126       val action = new PrivilegedExceptionAction[ConnectionWrapper]() {
127         override def run(): ConnectionWrapper = doCreateConnection(conf, validate)
128       }
129       val user = UserGroupInformation.getLoginUser
130       logger.info(s"Creating Secured HBase connection with user $user")
131       user.doAs(action)
132     } else {
133       logger.info(s"Creating unsecured HBase connection")
134       doCreateConnection(conf, validate)
135     }
136   }
137 
138   private def doCreateConnection(conf: Configuration, validate: Boolean): ConnectionWrapper = {
139     if (validate) {
140       logger.debug("Checking configuration availability")
141       HBaseVersions.checkAvailable(conf)
142     }
143     val connection = ConnectionFactory.createConnection(conf)
144     val kerberos = if (User.isHBaseSecurityEnabled(conf)) { Some(HadoopUtils.kerberosTicketRenewer()) } else { None }
145     SingletonConnection(connection, kerberos)
146   }
147 
148   /**
149    * Configures hadoop security, based on the configuration.
150    *
151    * Note: hadoop security is configured globally - having different security settings in a single JVM
152    * will likely result in errors
153    *
154    * @param conf conf
155    */
156   def configureSecurity(conf: Configuration): Unit = synchronized {
157     import AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE
158 
159     if (User.isHBaseSecurityEnabled(conf)) {
160       val currentUser = UserGroupInformation.getLoginUser
161       if (currentUser.getCredentials.getAllTokens.asScala.exists(_.getKind == AUTH_TOKEN_TYPE)) {
162         logger.debug("Using existing HBase authentication token")
163       } else {
164         val keytab = conf.get(HBaseGeoMesaKeyTab)
165         val rawPrincipal = conf.get(HBaseGeoMesaPrincipal)
166 
167         if (keytab == null || rawPrincipal == null) {
168           lazy val missing =
169             Seq(HBaseGeoMesaKeyTab -> keytab, HBaseGeoMesaPrincipal -> rawPrincipal).collect { case (k, null) => k }
170           logger.warn(s"Security is enabled but missing credentials under '${missing.mkString("' and '")}'")
171         } else {
172           val principal = fullPrincipal(rawPrincipal)
173 
174           lazy val principalMsg =
175             s"'$principal'${if (principal == rawPrincipal) { "" } else { s" (original '$rawPrincipal')"}}"
176           logger.debug(
177             s"Using Kerberos with principal $principalMsg, keytab '$keytab', " +
178                 s"and Hadoop authentication method '${SecurityUtil.getAuthenticationMethod(conf)}'")
179 
180           if (currentUser.hasKerberosCredentials && currentUser.getUserName == principal) {
181             logger.debug(s"User '$principal' is already authenticated")
182           } else {
183             if (currentUser.hasKerberosCredentials) {
184               logger.warn(
185                 s"Changing global authenticated Hadoop user from '${currentUser.getUserName}' to '$principal' -" +
186                     "this will affect any connections still using the old user")
187             }
188             UserGroupInformation.setConfiguration(conf)
189             UserGroupInformation.loginUserFromKeytab(principal, keytab)
190 
191             logger.debug(s"Logged into Hadoop with user '${UserGroupInformation.getLoginUser.getUserName}'")
192           }
193         }
194       }
195     }
196   }
197 
198   /**
199    * Replace _HOST with the current host and add the default realm if nothing is specified.
200    *
201    * `SecurityUtil.getServerPrincipal` will replace the _HOST but only if there is already a realm.
202    *
203    * @param principal kerberos principal
204    * @return
205    */
206   private def fullPrincipal(principal: String): String = {
207     if (principal.indexOf('@') != -1) {
208       // we have a realm so this should be work to replace _HOST if present
209       SecurityUtil.getServerPrincipal(principal, null: String)
210     } else {
211       // try to add the default realm and replace _HOST if present
212       Try(KerberosUtil.getDefaultRealm) match {
213         case Success(realm) => SecurityUtil.getServerPrincipal(s"$principal@$realm", null: String)
214         case Failure(e) =>
215           logger.warn(s"Unable to get default Kerberos realm: $e")
216           if (!principal.contains(SecurityUtil.HOSTNAME_PATTERN)) { principal } else {
217             // append a fake realm so that the _HOST replacement works and then remove it afterwards
218             SecurityUtil.getServerPrincipal(s"$principal@foo", null: String).dropRight(4)
219           }
220       }
221     }
222   }
223 
224   /**
225    * Managed connection. The connection itself should not be closed - instead close the wrapper to handle
226    * lifecycle events appropriately.
227    */
228   sealed trait ConnectionWrapper extends Closeable {
229     val connection: Connection
230   }
231 
232   /**
233    * An unshared connection
234    *
235    * @param connection connection
236    * @param kerberos kerberos ticket renewal thread
237    */
238   case class SingletonConnection(connection: Connection, kerberos: Option[Closeable]) extends ConnectionWrapper {
239     override def close(): Unit = CloseWithLogging(kerberos.toSeq ++ Seq(connection))
240   }
241 
242   /**
243    * A shared, cached connection
244    *
245    * @param connection connection
246    * @param kerberos kerberos ticket renewal thread
247    */
248   case class CachedConnection(connection: Connection, kerberos: Option[Closeable]) extends ConnectionWrapper {
249     override def close(): Unit = {}
250   }
251 
252   /**
253    * Provided connection - no lifecycle management is performed
254    *
255    * @param connection connection
256    */
257   case class ProvidedConnection(connection: Connection) extends ConnectionWrapper {
258     override def close(): Unit = {}
259   }
260 
261   private case class ConfigKey(zookeepers: Option[String], paths: Option[String], xml: Option[String])
262 }
Line Stmt Id Pos Tree Symbol Tests Code
36 158 1886 - 3344 Apply com.github.benmanes.caffeine.cache.Caffeine.build com.github.benmanes.caffeine.cache.Caffeine.newBuilder().build[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConfigKey, org.apache.hadoop.conf.Configuration]({ final class $anon extends Object with com.github.benmanes.caffeine.cache.CacheLoader[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConfigKey,org.apache.hadoop.conf.Configuration] { def <init>(): <$anon: com.github.benmanes.caffeine.cache.CacheLoader[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConfigKey,org.apache.hadoop.conf.Configuration]> = { $anon.super.<init>(); () }; <stable> <accessor> lazy private val configuration: org.apache.hadoop.conf.Configuration = { val base: org.apache.hadoop.conf.Configuration = org.apache.hadoop.hbase.HBaseConfiguration.create(); org.locationtech.geomesa.hbase.`package`.HBaseSystemProperties.ConfigPathProperty.option.foreach[Unit](((x$1: String) => $anon.this.addResources(base, x$1))); base }; override def load(key: org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConfigKey): org.apache.hadoop.conf.Configuration = { val conf: org.apache.hadoop.conf.Configuration = new org.apache.hadoop.conf.Configuration($anon.this.configuration); conf.set("hbase.client.userprovider.class", "org.locationtech.geomesa.hbase.data.LoginUserProvider"); key.xml.foreach[Unit](((xml: String) => conf.addResource(new java.io.ByteArrayInputStream(xml.getBytes(java.nio.charset.StandardCharsets.UTF_8))))); key.paths.foreach[Unit](((x$2: String) => $anon.this.addResources(conf, x$2))); key.zookeepers.foreach[Unit](((zk: String) => conf.set("hbase.zookeeper.quorum", zk))); if (key.zookeepers.isEmpty.&&(conf.get("hbase.zookeeper.quorum").==("localhost"))) (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("HBase connection is set to localhost - this may indicate that \'hbase-site.xml\' is not on the classpath") else (): Unit) else (); conf }; private def addResources(conf: org.apache.hadoop.conf.Configuration, paths: String): Unit = scala.Predef.refArrayOps[String](scala.Predef.refArrayOps[String](scala.Predef.refArrayOps[String](scala.Predef.augmentString(paths).split(',')).map[String, Array[String]](((x$3: String) => x$3.trim()))(scala.this.Array.canBuildFrom[String]((ClassTag.apply[String](classOf[java.lang.String]): scala.reflect.ClassTag[String])))).filterNot(((x$4: String) => x$4.isEmpty()))).foreach[Unit](((x$5: String) => org.locationtech.geomesa.utils.hadoop.HadoopUtils.addResource(conf, x$5))) }; new $anon() })
37 157 1919 - 1922 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.$anon.<init> new $anon()
47 133 2348 - 2380 Apply org.apache.hadoop.conf.Configuration.<init> new org.apache.hadoop.conf.Configuration($anon.this.configuration)
49 134 2453 - 2553 Apply org.apache.hadoop.conf.Configuration.set conf.set("hbase.client.userprovider.class", "org.locationtech.geomesa.hbase.data.LoginUserProvider")
51 135 2731 - 2753 Select java.nio.charset.StandardCharsets.UTF_8 java.nio.charset.StandardCharsets.UTF_8
51 136 2718 - 2754 Apply java.lang.String.getBytes xml.getBytes(java.nio.charset.StandardCharsets.UTF_8)
51 137 2693 - 2755 Apply java.io.ByteArrayInputStream.<init> new java.io.ByteArrayInputStream(xml.getBytes(java.nio.charset.StandardCharsets.UTF_8))
51 138 2676 - 2756 Apply org.apache.hadoop.conf.Configuration.addResource conf.addResource(new java.io.ByteArrayInputStream(xml.getBytes(java.nio.charset.StandardCharsets.UTF_8)))
51 139 2653 - 2757 Apply scala.Option.foreach key.xml.foreach[Unit](((xml: String) => conf.addResource(new java.io.ByteArrayInputStream(xml.getBytes(java.nio.charset.StandardCharsets.UTF_8)))))
52 140 2784 - 2805 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.$anon.addResources $anon.this.addResources(conf, x$2)
52 141 2766 - 2806 Apply scala.Option.foreach key.paths.foreach[Unit](((x$2: String) => $anon.this.addResources(conf, x$2)))
53 142 2844 - 2885 Apply org.apache.hadoop.conf.Configuration.set conf.set("hbase.zookeeper.quorum", zk)
53 143 2815 - 2886 Apply scala.Option.foreach key.zookeepers.foreach[Unit](((zk: String) => conf.set("hbase.zookeeper.quorum", zk)))
54 144 2925 - 2977 Apply java.lang.Object.== conf.get("hbase.zookeeper.quorum").==("localhost")
54 145 2899 - 2977 Apply scala.Boolean.&& key.zookeepers.isEmpty.&&(conf.get("hbase.zookeeper.quorum").==("localhost"))
54 147 2895 - 2895 Literal <nosymbol> ()
54 148 2895 - 2895 Block <nosymbol> ()
55 146 2991 - 3127 Typed <nosymbol> (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("HBase connection is set to localhost - this may indicate that \'hbase-site.xml\' is not on the classpath") else (): Unit)
62 149 3243 - 3259 Apply scala.collection.immutable.StringLike.split scala.Predef.augmentString(paths).split(',')
62 150 3264 - 3270 Apply java.lang.String.trim x$3.trim()
62 151 3263 - 3263 ApplyToImplicitArgs scala.Array.canBuildFrom scala.this.Array.canBuildFrom[String]((ClassTag.apply[String](classOf[java.lang.String]): scala.reflect.ClassTag[String]))
62 152 3243 - 3271 ApplyToImplicitArgs scala.collection.TraversableLike.map scala.Predef.refArrayOps[String](scala.Predef.augmentString(paths).split(',')).map[String, Array[String]](((x$3: String) => x$3.trim()))(scala.this.Array.canBuildFrom[String]((ClassTag.apply[String](classOf[java.lang.String]): scala.reflect.ClassTag[String])))
62 153 3282 - 3291 Apply java.lang.String.isEmpty x$4.isEmpty()
62 154 3243 - 3292 Apply scala.collection.TraversableLike.filterNot scala.Predef.refArrayOps[String](scala.Predef.refArrayOps[String](scala.Predef.augmentString(paths).split(',')).map[String, Array[String]](((x$3: String) => x$3.trim()))(scala.this.Array.canBuildFrom[String]((ClassTag.apply[String](classOf[java.lang.String]): scala.reflect.ClassTag[String])))).filterNot(((x$4: String) => x$4.isEmpty()))
62 155 3301 - 3333 Apply org.locationtech.geomesa.utils.hadoop.HadoopUtils.addResource org.locationtech.geomesa.utils.hadoop.HadoopUtils.addResource(conf, x$5)
62 156 3243 - 3334 Apply scala.collection.IndexedSeqOptimized.foreach scala.Predef.refArrayOps[String](scala.Predef.refArrayOps[String](scala.Predef.refArrayOps[String](scala.Predef.augmentString(paths).split(',')).map[String, Array[String]](((x$3: String) => x$3.trim()))(scala.this.Array.canBuildFrom[String]((ClassTag.apply[String](classOf[java.lang.String]): scala.reflect.ClassTag[String])))).filterNot(((x$4: String) => x$4.isEmpty()))).foreach[Unit](((x$5: String) => org.locationtech.geomesa.utils.hadoop.HadoopUtils.addResource(conf, x$5)))
66 167 3433 - 3884 Apply com.github.benmanes.caffeine.cache.Caffeine.build com.github.benmanes.caffeine.cache.Caffeine.newBuilder().build[(org.apache.hadoop.conf.Configuration, Boolean), org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection]({ final class $anon extends Object with com.github.benmanes.caffeine.cache.CacheLoader[(org.apache.hadoop.conf.Configuration, Boolean),org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection] { def <init>(): <$anon: com.github.benmanes.caffeine.cache.CacheLoader[(org.apache.hadoop.conf.Configuration, Boolean),org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection]> = { $anon.super.<init>(); () }; override def load(key: (org.apache.hadoop.conf.Configuration, Boolean)): org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection = HBaseConnectionPool.this.createConnection(key._1, key._2) match { case (connection: org.apache.hadoop.hbase.client.Connection, kerberos: Option[java.io.Closeable])org.locationtech.geomesa.hbase.data.HBaseConnectionPool.SingletonConnection((connection @ _), (kerberos @ _)) => HBaseConnectionPool.this.CachedConnection.apply(connection, kerberos) case (c @ _) => throw new scala.`package`.UnsupportedOperationException(scala.StringContext.apply("Expected SingletonConnection but got ", "").s(c)) } }; new $anon() })
67 166 3466 - 3469 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.$anon.<init> new $anon()
69 159 3630 - 3636 Select scala.Tuple2._1 key._1
69 160 3638 - 3644 Select scala.Tuple2._2 key._2
69 161 3613 - 3645 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.createConnection HBaseConnectionPool.this.createConnection(key._1, key._2)
70 162 3714 - 3752 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection.apply HBaseConnectionPool.this.CachedConnection.apply(connection, kerberos)
70 163 3714 - 3752 Block org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection.apply HBaseConnectionPool.this.CachedConnection.apply(connection, kerberos)
71 164 3773 - 3856 Throw <nosymbol> throw new scala.`package`.UnsupportedOperationException(scala.StringContext.apply("Expected SingletonConnection but got ", "").s(c))
71 165 3773 - 3856 Block <nosymbol> throw new scala.`package`.UnsupportedOperationException(scala.StringContext.apply("Expected SingletonConnection but got ", "").s(c))
77 178 3923 - 3926 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.$anon.<init> new $anon()
77 179 3888 - 4089 Apply java.lang.Runtime.addShutdownHook java.lang.Runtime.getRuntime().addShutdownHook({ final class $anon extends java.lang.Thread { def <init>(): <$anon: Thread> = { $anon.super.<init>(); () }; override def run(): Unit = { org.locationtech.geomesa.utils.io.`package`.CloseWithLogging.apply[Iterable[java.io.Closeable]](scala.collection.JavaConverters.collectionAsScalaIterableConverter[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection](HBaseConnectionPool.this.connections.asMap().values()).asScala.flatMap[java.io.Closeable, Iterable[java.io.Closeable]](((x0$1: org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection) => x0$1 match { case (connection: org.apache.hadoop.hbase.client.Connection, kerberos: Option[java.io.Closeable])org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection((c @ _), (k @ _)) => scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](c).++[java.io.Closeable, Seq[java.io.Closeable]](scala.this.Option.option2Iterable[java.io.Closeable](k))(collection.this.Seq.canBuildFrom[java.io.Closeable]) }))(collection.this.Iterable.canBuildFrom[java.io.Closeable]))(io.this.IsCloseable.iterableIsCloseable); () } }; new $anon() })
79 168 3992 - 4020 Apply java.util.Map.values HBaseConnectionPool.this.connections.asMap().values()
79 169 4080 - 4081 ApplyImplicitView scala.Option.option2Iterable scala.this.Option.option2Iterable[java.io.Closeable](k)
79 170 4077 - 4077 TypeApply scala.collection.Seq.canBuildFrom collection.this.Seq.canBuildFrom[java.io.Closeable]
79 171 4070 - 4081 ApplyToImplicitArgs scala.collection.TraversableLike.++ scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](c).++[java.io.Closeable, Seq[java.io.Closeable]](scala.this.Option.option2Iterable[java.io.Closeable](k))(collection.this.Seq.canBuildFrom[java.io.Closeable])
79 172 4070 - 4081 Block scala.collection.TraversableLike.++ scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](c).++[java.io.Closeable, Seq[java.io.Closeable]](scala.this.Option.option2Iterable[java.io.Closeable](k))(collection.this.Seq.canBuildFrom[java.io.Closeable])
79 173 4037 - 4037 TypeApply scala.collection.Iterable.canBuildFrom collection.this.Iterable.canBuildFrom[java.io.Closeable]
79 174 3992 - 4083 ApplyToImplicitArgs scala.collection.TraversableLike.flatMap scala.collection.JavaConverters.collectionAsScalaIterableConverter[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection](HBaseConnectionPool.this.connections.asMap().values()).asScala.flatMap[java.io.Closeable, Iterable[java.io.Closeable]](((x0$1: org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection) => x0$1 match { case (connection: org.apache.hadoop.hbase.client.Connection, kerberos: Option[java.io.Closeable])org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection((c @ _), (k @ _)) => scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](c).++[java.io.Closeable, Seq[java.io.Closeable]](scala.this.Option.option2Iterable[java.io.Closeable](k))(collection.this.Seq.canBuildFrom[java.io.Closeable]) }))(collection.this.Iterable.canBuildFrom[java.io.Closeable])
79 175 3991 - 3991 Select org.locationtech.geomesa.utils.io.IsCloseableImplicits.iterableIsCloseable io.this.IsCloseable.iterableIsCloseable
79 176 3975 - 4084 ApplyToImplicitArgs org.locationtech.geomesa.utils.io.CloseWithLogging.apply org.locationtech.geomesa.utils.io.`package`.CloseWithLogging.apply[Iterable[java.io.Closeable]](scala.collection.JavaConverters.collectionAsScalaIterableConverter[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection](HBaseConnectionPool.this.connections.asMap().values()).asScala.flatMap[java.io.Closeable, Iterable[java.io.Closeable]](((x0$1: org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection) => x0$1 match { case (connection: org.apache.hadoop.hbase.client.Connection, kerberos: Option[java.io.Closeable])org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection((c @ _), (k @ _)) => scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](c).++[java.io.Closeable, Seq[java.io.Closeable]](scala.this.Option.option2Iterable[java.io.Closeable](k))(collection.this.Seq.canBuildFrom[java.io.Closeable]) }))(collection.this.Iterable.canBuildFrom[java.io.Closeable]))(io.this.IsCloseable.iterableIsCloseable)
79 177 3991 - 3991 Literal <nosymbol> ()
89 180 4291 - 4323 Apply org.locationtech.geomesa.utils.geotools.GeoMesaParam.lookupOpt org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ZookeeperParam.lookupOpt(params)
90 181 4340 - 4374 Apply org.locationtech.geomesa.utils.geotools.GeoMesaParam.lookupOpt org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ConfigPathsParam.lookupOpt(params)
91 182 4389 - 4419 Apply org.locationtech.geomesa.utils.geotools.GeoMesaParam.lookupOpt org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ConfigsParam.lookupOpt(params)
92 183 4436 - 4461 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConfigKey.apply HBaseConnectionPool.this.ConfigKey.apply(zk, paths, xml)
92 184 4424 - 4462 Apply com.github.benmanes.caffeine.cache.LoadingCache.get HBaseConnectionPool.this.configs.get(HBaseConnectionPool.this.ConfigKey.apply(zk, paths, xml))
103 185 4748 - 4778 Apply org.locationtech.geomesa.utils.geotools.GeoMesaParam.exists org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ConnectionParam.exists(params)
104 186 4807 - 4837 Apply org.locationtech.geomesa.utils.geotools.GeoMesaParam.lookup org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ConnectionParam.lookup(params)
104 187 4788 - 4838 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ProvidedConnection.apply HBaseConnectionPool.this.ProvidedConnection.apply(org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ConnectionParam.lookup(params))
104 188 4788 - 4838 Block org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ProvidedConnection.apply HBaseConnectionPool.this.ProvidedConnection.apply(org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ConnectionParam.lookup(params))
105 197 4850 - 5172 Block <nosymbol> { val conf: org.apache.hadoop.conf.Configuration = HBaseConnectionPool.this.getConfiguration(params); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Connecting to HBase instance at {}", (conf.get("hbase.zookeeper.quorum"): AnyRef)) else (): Unit); if (scala.Predef.Boolean2boolean(HBaseDataStoreParams.CacheConnectionsParam.lookup(params))) HBaseConnectionPool.this.connections.get(scala.Tuple2.apply[org.apache.hadoop.conf.Configuration, Boolean](conf, validate)) else HBaseConnectionPool.this.createConnection(conf, validate) }
106 189 4869 - 4893 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.getConfiguration HBaseConnectionPool.this.getConfiguration(params)
108 190 5000 - 5057 Apply org.locationtech.geomesa.utils.geotools.GeoMesaParam.lookup HBaseDataStoreParams.CacheConnectionsParam.lookup(params)
108 191 5000 - 5057 ApplyImplicitView scala.Predef.Boolean2boolean scala.Predef.Boolean2boolean(HBaseDataStoreParams.CacheConnectionsParam.lookup(params))
109 192 5085 - 5101 Apply scala.Tuple2.apply scala.Tuple2.apply[org.apache.hadoop.conf.Configuration, Boolean](conf, validate)
109 193 5069 - 5102 Apply com.github.benmanes.caffeine.cache.LoadingCache.get HBaseConnectionPool.this.connections.get(scala.Tuple2.apply[org.apache.hadoop.conf.Configuration, Boolean](conf, validate))
109 194 5069 - 5102 Block com.github.benmanes.caffeine.cache.LoadingCache.get HBaseConnectionPool.this.connections.get(scala.Tuple2.apply[org.apache.hadoop.conf.Configuration, Boolean](conf, validate))
111 195 5126 - 5158 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.createConnection HBaseConnectionPool.this.createConnection(conf, validate)
111 196 5126 - 5158 Block org.locationtech.geomesa.hbase.data.HBaseConnectionPool.createConnection HBaseConnectionPool.this.createConnection(conf, validate)
124 198 5449 - 5482 Apply org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled(conf)
124 204 5484 - 5831 Block <nosymbol> { HBaseConnectionPool.this.configureSecurity(conf); val action: java.security.PrivilegedExceptionAction[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConnectionWrapper] = { final class $anon extends Object with java.security.PrivilegedExceptionAction[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConnectionWrapper] { def <init>(): <$anon: java.security.PrivilegedExceptionAction[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConnectionWrapper]> = { $anon.super.<init>(); () }; override def run(): org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConnectionWrapper = HBaseConnectionPool.this.doCreateConnection(conf, validate) }; new $anon() }; val user: org.apache.hadoop.security.UserGroupInformation = org.apache.hadoop.security.UserGroupInformation.getLoginUser(); (if (HBaseConnectionPool.this.logger.underlying.isInfoEnabled()) HBaseConnectionPool.this.logger.underlying.info("Creating Secured HBase connection with user {}", (user: AnyRef)) else (): Unit); user.doAs[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConnectionWrapper](action) }
125 199 5492 - 5515 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.configureSecurity HBaseConnectionPool.this.configureSecurity(conf)
126 201 5535 - 5538 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.$anon.<init> new $anon()
127 200 5636 - 5670 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.doCreateConnection HBaseConnectionPool.this.doCreateConnection(conf, validate)
129 202 5696 - 5729 Apply org.apache.hadoop.security.UserGroupInformation.getLoginUser org.apache.hadoop.security.UserGroupInformation.getLoginUser()
131 203 5808 - 5825 Apply org.apache.hadoop.security.UserGroupInformation.doAs user.doAs[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConnectionWrapper](action)
132 206 5837 - 5943 Block <nosymbol> { (if (HBaseConnectionPool.this.logger.underlying.isInfoEnabled()) HBaseConnectionPool.this.logger.underlying.info("Creating unsecured HBase connection") else (): Unit); HBaseConnectionPool.this.doCreateConnection(conf, validate) }
134 205 5903 - 5937 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.doCreateConnection HBaseConnectionPool.this.doCreateConnection(conf, validate)
139 208 6063 - 6169 Block <nosymbol> { (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Checking configuration availability") else (): Unit); org.locationtech.geomesa.hbase.utils.HBaseVersions.checkAvailable(conf) }
139 209 6049 - 6049 Literal <nosymbol> ()
139 210 6049 - 6049 Block <nosymbol> ()
141 207 6129 - 6163 Apply org.locationtech.geomesa.hbase.utils.HBaseVersions.checkAvailable org.locationtech.geomesa.hbase.utils.HBaseVersions.checkAvailable(conf)
143 211 6191 - 6231 Apply org.apache.hadoop.hbase.client.ConnectionFactory.createConnection org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(conf)
144 212 6255 - 6288 Apply org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled(conf)
144 213 6297 - 6332 Apply org.locationtech.geomesa.utils.hadoop.HadoopUtils.kerberosTicketRenewer org.locationtech.geomesa.utils.hadoop.HadoopUtils.kerberosTicketRenewer()
144 214 6292 - 6333 Apply scala.Some.apply scala.Some.apply[java.io.Closeable](org.locationtech.geomesa.utils.hadoop.HadoopUtils.kerberosTicketRenewer())
144 215 6292 - 6333 Block scala.Some.apply scala.Some.apply[java.io.Closeable](org.locationtech.geomesa.utils.hadoop.HadoopUtils.kerberosTicketRenewer())
144 216 6343 - 6347 Select scala.None scala.None
144 217 6343 - 6347 Block scala.None scala.None
145 218 6354 - 6395 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.SingletonConnection.apply HBaseConnectionPool.this.SingletonConnection.apply(connection, kerberos)
156 250 6696 - 8641 Apply java.lang.Object.synchronized HBaseConnectionPool.this.synchronized[Unit]({ import org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE; if (org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled(conf)) { val currentUser: org.apache.hadoop.security.UserGroupInformation = org.apache.hadoop.security.UserGroupInformation.getLoginUser(); if (scala.collection.JavaConverters.collectionAsScalaIterableConverter[org.apache.hadoop.security.token.Token[_ <: org.apache.hadoop.security.token.TokenIdentifier]](currentUser.getCredentials().getAllTokens()).asScala.exists(((x$6: org.apache.hadoop.security.token.Token[_ <: org.apache.hadoop.security.token.TokenIdentifier]) => x$6.getKind().==(org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE)))) (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Using existing HBase authentication token") else (): Unit) else { val keytab: String = conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab); val rawPrincipal: String = conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal); if (keytab.==(null).||(rawPrincipal.==(null))) { <stable> <accessor> lazy val missing: Seq[String] = scala.collection.Seq.apply[(String, String)](scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab).->[String](keytab), scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal).->[String](rawPrincipal)).collect[String, Seq[String]](({ @SerialVersionUID(value = 0) final <synthetic> class $anonfun extends scala.runtime.AbstractPartialFunction[(String, String),String] with Serializable { def <init>(): <$anon: ((String, String)) => String> = { $anonfun.super.<init>(); () }; final override def applyOrElse[A1 <: (String, String), B1 >: String](x1: A1, default: A1 => B1): B1 = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => k case (defaultCase$ @ _) => default.apply(x1) }; final def isDefinedAt(x1: (String, String)): Boolean = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => true case (defaultCase$ @ _) => false } }; new $anonfun() }: PartialFunction[(String, String),String]))(collection.this.Seq.canBuildFrom[String]); (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("Security is enabled but missing credentials under \'{}\'", (missing.mkString("\' and \'"): AnyRef)) else (): Unit) } else { val principal: String = HBaseConnectionPool.this.fullPrincipal(rawPrincipal); <stable> <accessor> lazy val principalMsg: String = scala.StringContext.apply("\'", "\'", "").s(principal, if (principal.==(rawPrincipal)) "" else scala.StringContext.apply(" (original \'", "\')").s(rawPrincipal)); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug(scala.StringContext.apply("Using Kerberos with principal ", ", keytab \'", "\', ").s(principalMsg, keytab).+(scala.StringContext.apply("and Hadoop authentication method \'", "\'").s(org.apache.hadoop.security.SecurityUtil.getAuthenticationMethod(conf)))) else (): Unit); if (currentUser.hasKerberosCredentials().&&(currentUser.getUserName().==(principal))) (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("User \'{}\' is already authenticated", (principal: AnyRef)) else (): Unit) else { if (currentUser.hasKerberosCredentials()) (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn(scala.StringContext.apply("Changing global authenticated Hadoop user from \'", "\' to \'", "\' -").s(currentUser.getUserName(), principal).+("this will affect any connections still using the old user")) else (): Unit) else (); org.apache.hadoop.security.UserGroupInformation.setConfiguration(conf); org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(principal, keytab); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Logged into Hadoop with user \'{}\'", (org.apache.hadoop.security.UserGroupInformation.getLoginUser().getUserName(): AnyRef)) else (): Unit) } } } } else () })
159 219 6777 - 6810 Apply org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled(conf)
159 247 6812 - 8637 Block <nosymbol> { val currentUser: org.apache.hadoop.security.UserGroupInformation = org.apache.hadoop.security.UserGroupInformation.getLoginUser(); if (scala.collection.JavaConverters.collectionAsScalaIterableConverter[org.apache.hadoop.security.token.Token[_ <: org.apache.hadoop.security.token.TokenIdentifier]](currentUser.getCredentials().getAllTokens()).asScala.exists(((x$6: org.apache.hadoop.security.token.Token[_ <: org.apache.hadoop.security.token.TokenIdentifier]) => x$6.getKind().==(org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE)))) (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Using existing HBase authentication token") else (): Unit) else { val keytab: String = conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab); val rawPrincipal: String = conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal); if (keytab.==(null).||(rawPrincipal.==(null))) { <stable> <accessor> lazy val missing: Seq[String] = scala.collection.Seq.apply[(String, String)](scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab).->[String](keytab), scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal).->[String](rawPrincipal)).collect[String, Seq[String]](({ @SerialVersionUID(value = 0) final <synthetic> class $anonfun extends scala.runtime.AbstractPartialFunction[(String, String),String] with Serializable { def <init>(): <$anon: ((String, String)) => String> = { $anonfun.super.<init>(); () }; final override def applyOrElse[A1 <: (String, String), B1 >: String](x1: A1, default: A1 => B1): B1 = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => k case (defaultCase$ @ _) => default.apply(x1) }; final def isDefinedAt(x1: (String, String)): Boolean = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => true case (defaultCase$ @ _) => false } }; new $anonfun() }: PartialFunction[(String, String),String]))(collection.this.Seq.canBuildFrom[String]); (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("Security is enabled but missing credentials under \'{}\'", (missing.mkString("\' and \'"): AnyRef)) else (): Unit) } else { val principal: String = HBaseConnectionPool.this.fullPrincipal(rawPrincipal); <stable> <accessor> lazy val principalMsg: String = scala.StringContext.apply("\'", "\'", "").s(principal, if (principal.==(rawPrincipal)) "" else scala.StringContext.apply(" (original \'", "\')").s(rawPrincipal)); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug(scala.StringContext.apply("Using Kerberos with principal ", ", keytab \'", "\', ").s(principalMsg, keytab).+(scala.StringContext.apply("and Hadoop authentication method \'", "\'").s(org.apache.hadoop.security.SecurityUtil.getAuthenticationMethod(conf)))) else (): Unit); if (currentUser.hasKerberosCredentials().&&(currentUser.getUserName().==(principal))) (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("User \'{}\' is already authenticated", (principal: AnyRef)) else (): Unit) else { if (currentUser.hasKerberosCredentials()) (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn(scala.StringContext.apply("Changing global authenticated Hadoop user from \'", "\' to \'", "\' -").s(currentUser.getUserName(), principal).+("this will affect any connections still using the old user")) else (): Unit) else (); org.apache.hadoop.security.UserGroupInformation.setConfiguration(conf); org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(principal, keytab); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Logged into Hadoop with user \'{}\'", (org.apache.hadoop.security.UserGroupInformation.getLoginUser().getUserName(): AnyRef)) else (): Unit) } } } }
159 248 6773 - 6773 Literal <nosymbol> ()
159 249 6773 - 6773 Block <nosymbol> ()
160 220 6838 - 6871 Apply org.apache.hadoop.security.UserGroupInformation.getLoginUser org.apache.hadoop.security.UserGroupInformation.getLoginUser()
161 221 6882 - 6921 Apply org.apache.hadoop.security.Credentials.getAllTokens currentUser.getCredentials().getAllTokens()
161 222 6950 - 6965 Select org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE
161 223 6937 - 6965 Apply java.lang.Object.== x$6.getKind().==(org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE)
161 224 6882 - 6966 Apply scala.collection.IterableLike.exists scala.collection.JavaConverters.collectionAsScalaIterableConverter[org.apache.hadoop.security.token.Token[_ <: org.apache.hadoop.security.token.TokenIdentifier]](currentUser.getCredentials().getAllTokens()).asScala.exists(((x$6: org.apache.hadoop.security.token.Token[_ <: org.apache.hadoop.security.token.TokenIdentifier]) => x$6.getKind().==(org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE)))
162 225 6978 - 7035 Typed <nosymbol> (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Using existing HBase authentication token") else (): Unit)
163 246 7049 - 8631 Block <nosymbol> { val keytab: String = conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab); val rawPrincipal: String = conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal); if (keytab.==(null).||(rawPrincipal.==(null))) { <stable> <accessor> lazy val missing: Seq[String] = scala.collection.Seq.apply[(String, String)](scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab).->[String](keytab), scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal).->[String](rawPrincipal)).collect[String, Seq[String]](({ @SerialVersionUID(value = 0) final <synthetic> class $anonfun extends scala.runtime.AbstractPartialFunction[(String, String),String] with Serializable { def <init>(): <$anon: ((String, String)) => String> = { $anonfun.super.<init>(); () }; final override def applyOrElse[A1 <: (String, String), B1 >: String](x1: A1, default: A1 => B1): B1 = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => k case (defaultCase$ @ _) => default.apply(x1) }; final def isDefinedAt(x1: (String, String)): Boolean = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => true case (defaultCase$ @ _) => false } }; new $anonfun() }: PartialFunction[(String, String),String]))(collection.this.Seq.canBuildFrom[String]); (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("Security is enabled but missing credentials under \'{}\'", (missing.mkString("\' and \'"): AnyRef)) else (): Unit) } else { val principal: String = HBaseConnectionPool.this.fullPrincipal(rawPrincipal); <stable> <accessor> lazy val principalMsg: String = scala.StringContext.apply("\'", "\'", "").s(principal, if (principal.==(rawPrincipal)) "" else scala.StringContext.apply(" (original \'", "\')").s(rawPrincipal)); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug(scala.StringContext.apply("Using Kerberos with principal ", ", keytab \'", "\', ").s(principalMsg, keytab).+(scala.StringContext.apply("and Hadoop authentication method \'", "\'").s(org.apache.hadoop.security.SecurityUtil.getAuthenticationMethod(conf)))) else (): Unit); if (currentUser.hasKerberosCredentials().&&(currentUser.getUserName().==(principal))) (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("User \'{}\' is already authenticated", (principal: AnyRef)) else (): Unit) else { if (currentUser.hasKerberosCredentials()) (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn(scala.StringContext.apply("Changing global authenticated Hadoop user from \'", "\' to \'", "\' -").s(currentUser.getUserName(), principal).+("this will affect any connections still using the old user")) else (): Unit) else (); org.apache.hadoop.security.UserGroupInformation.setConfiguration(conf); org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(principal, keytab); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Logged into Hadoop with user \'{}\'", (org.apache.hadoop.security.UserGroupInformation.getLoginUser().getUserName(): AnyRef)) else (): Unit) } } }
164 226 7081 - 7099 Select org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab
164 227 7072 - 7100 Apply org.apache.hadoop.conf.Configuration.get conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab)
165 228 7137 - 7158 Select org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal
165 229 7128 - 7159 Apply org.apache.hadoop.conf.Configuration.get conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal)
167 230 7183 - 7187 Literal <nosymbol> null
167 231 7191 - 7211 Apply java.lang.Object.== rawPrincipal.==(null)
167 232 7173 - 7211 Apply scala.Boolean.|| keytab.==(null).||(rawPrincipal.==(null))
167 233 7213 - 7479 Block <nosymbol> { <stable> <accessor> lazy val missing: Seq[String] = scala.collection.Seq.apply[(String, String)](scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab).->[String](keytab), scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal).->[String](rawPrincipal)).collect[String, Seq[String]](({ @SerialVersionUID(value = 0) final <synthetic> class $anonfun extends scala.runtime.AbstractPartialFunction[(String, String),String] with Serializable { def <init>(): <$anon: ((String, String)) => String> = { $anonfun.super.<init>(); () }; final override def applyOrElse[A1 <: (String, String), B1 >: String](x1: A1, default: A1 => B1): B1 = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => k case (defaultCase$ @ _) => default.apply(x1) }; final def isDefinedAt(x1: (String, String)): Boolean = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => true case (defaultCase$ @ _) => false } }; new $anonfun() }: PartialFunction[(String, String),String]))(collection.this.Seq.canBuildFrom[String]); (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("Security is enabled but missing credentials under \'{}\'", (missing.mkString("\' and \'"): AnyRef)) else (): Unit) }
171 245 7485 - 8623 Block <nosymbol> { val principal: String = HBaseConnectionPool.this.fullPrincipal(rawPrincipal); <stable> <accessor> lazy val principalMsg: String = scala.StringContext.apply("\'", "\'", "").s(principal, if (principal.==(rawPrincipal)) "" else scala.StringContext.apply(" (original \'", "\')").s(rawPrincipal)); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug(scala.StringContext.apply("Using Kerberos with principal ", ", keytab \'", "\', ").s(principalMsg, keytab).+(scala.StringContext.apply("and Hadoop authentication method \'", "\'").s(org.apache.hadoop.security.SecurityUtil.getAuthenticationMethod(conf)))) else (): Unit); if (currentUser.hasKerberosCredentials().&&(currentUser.getUserName().==(principal))) (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("User \'{}\' is already authenticated", (principal: AnyRef)) else (): Unit) else { if (currentUser.hasKerberosCredentials()) (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn(scala.StringContext.apply("Changing global authenticated Hadoop user from \'", "\' to \'", "\' -").s(currentUser.getUserName(), principal).+("this will affect any connections still using the old user")) else (): Unit) else (); org.apache.hadoop.security.UserGroupInformation.setConfiguration(conf); org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(principal, keytab); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Logged into Hadoop with user \'{}\'", (org.apache.hadoop.security.UserGroupInformation.getLoginUser().getUserName(): AnyRef)) else (): Unit) } }
172 234 7513 - 7540 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.fullPrincipal HBaseConnectionPool.this.fullPrincipal(rawPrincipal)
180 235 7942 - 7978 Apply java.lang.Object.== currentUser.getUserName().==(principal)
180 236 7904 - 7978 Apply scala.Boolean.&& currentUser.hasKerberosCredentials().&&(currentUser.getUserName().==(principal))
181 237 7994 - 8053 Typed <nosymbol> (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("User \'{}\' is already authenticated", (principal: AnyRef)) else (): Unit)
182 244 8071 - 8613 Block <nosymbol> { if (currentUser.hasKerberosCredentials()) (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn(scala.StringContext.apply("Changing global authenticated Hadoop user from \'", "\' to \'", "\' -").s(currentUser.getUserName(), principal).+("this will affect any connections still using the old user")) else (): Unit) else (); org.apache.hadoop.security.UserGroupInformation.setConfiguration(conf); org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(principal, keytab); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Logged into Hadoop with user \'{}\'", (org.apache.hadoop.security.UserGroupInformation.getLoginUser().getUserName(): AnyRef)) else (): Unit) }
183 238 8089 - 8123 Apply org.apache.hadoop.security.UserGroupInformation.hasKerberosCredentials currentUser.hasKerberosCredentials()
183 240 8085 - 8085 Literal <nosymbol> ()
183 241 8085 - 8085 Block <nosymbol> ()
184 239 8141 - 8349 Typed <nosymbol> (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn(scala.StringContext.apply("Changing global authenticated Hadoop user from \'", "\' to \'", "\' -").s(currentUser.getUserName(), principal).+("this will affect any connections still using the old user")) else (): Unit)
188 242 8376 - 8419 Apply org.apache.hadoop.security.UserGroupInformation.setConfiguration org.apache.hadoop.security.UserGroupInformation.setConfiguration(conf)
189 243 8432 - 8491 Apply org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(principal, keytab)
207 251 8978 - 9006 Apply scala.Int.!= principal.indexOf(64).!=(-1)
209 252 9135 - 9139 Literal <nosymbol> null
209 253 9092 - 9148 Apply org.apache.hadoop.security.SecurityUtil.getServerPrincipal org.apache.hadoop.security.SecurityUtil.getServerPrincipal(principal, (null: String))
209 254 9092 - 9148 Block org.apache.hadoop.security.SecurityUtil.getServerPrincipal org.apache.hadoop.security.SecurityUtil.getServerPrincipal(principal, (null: String))
212 255 9239 - 9267 Apply org.apache.hadoop.security.authentication.util.KerberosUtil.getDefaultRealm org.apache.hadoop.security.authentication.util.KerberosUtil.getDefaultRealm()
212 256 9235 - 9268 Apply scala.util.Try.apply scala.util.Try.apply[String](org.apache.hadoop.security.authentication.util.KerberosUtil.getDefaultRealm())
212 267 9235 - 9767 Match <nosymbol> scala.util.Try.apply[String](org.apache.hadoop.security.authentication.util.KerberosUtil.getDefaultRealm()) match { case (value: String)scala.util.Success[String]((realm @ _)) => org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@", "").s(principal, realm), (null: String)) case (exception: Throwable)scala.util.Failure[String]((e @ _)) => { (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("Unable to get default Kerberos realm: {}", (e: AnyRef)) else (): Unit); if (principal.contains("_HOST").unary_!) principal else scala.Predef.augmentString(org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@foo").s(principal), (null: String))).dropRight(4) } }
213 257 9340 - 9360 Apply scala.StringContext.s scala.StringContext.apply("", "@", "").s(principal, realm)
213 258 9362 - 9366 Literal <nosymbol> null
213 259 9308 - 9375 Apply org.apache.hadoop.security.SecurityUtil.getServerPrincipal org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@", "").s(principal, realm), (null: String))
213 260 9308 - 9375 Block org.apache.hadoop.security.SecurityUtil.getServerPrincipal org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@", "").s(principal, realm), (null: String))
214 266 9400 - 9759 Block <nosymbol> { (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("Unable to get default Kerberos realm: {}", (e: AnyRef)) else (): Unit); if (principal.contains("_HOST").unary_!) principal else scala.Predef.augmentString(org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@foo").s(principal), (null: String))).dropRight(4) }
216 261 9504 - 9533 Literal <nosymbol> "_HOST"
216 262 9484 - 9534 Select scala.Boolean.unary_! principal.contains("_HOST").unary_!
216 263 9538 - 9547 Ident org.locationtech.geomesa.hbase.data.HBaseConnectionPool.principal principal
218 264 9670 - 9747 Apply scala.collection.IndexedSeqOptimized.dropRight scala.Predef.augmentString(org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@foo").s(principal), (null: String))).dropRight(4)
218 265 9670 - 9747 Block scala.collection.IndexedSeqOptimized.dropRight scala.Predef.augmentString(org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@foo").s(principal), (null: String))).dropRight(4)
239 268 10318 - 10326 Select org.locationtech.geomesa.hbase.data.HBaseConnectionPool.SingletonConnection.kerberos SingletonConnection.this.kerberos
239 269 10340 - 10350 Select org.locationtech.geomesa.hbase.data.HBaseConnectionPool.SingletonConnection.connection SingletonConnection.this.connection
239 270 10336 - 10351 Apply scala.collection.generic.GenericCompanion.apply scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](SingletonConnection.this.connection)
239 271 10333 - 10333 TypeApply scala.collection.Seq.canBuildFrom collection.this.Seq.canBuildFrom[java.io.Closeable]
239 272 10318 - 10351 ApplyToImplicitArgs scala.collection.TraversableLike.++ scala.this.Option.option2Iterable[java.io.Closeable](SingletonConnection.this.kerberos).toSeq.++[java.io.Closeable, Seq[java.io.Closeable]](scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](SingletonConnection.this.connection))(collection.this.Seq.canBuildFrom[java.io.Closeable])
239 273 10317 - 10317 Select org.locationtech.geomesa.utils.io.IsCloseableImplicits.iterableIsCloseable io.this.IsCloseable.iterableIsCloseable
239 274 10301 - 10352 ApplyToImplicitArgs org.locationtech.geomesa.utils.io.CloseWithLogging.apply org.locationtech.geomesa.utils.io.`package`.CloseWithLogging.apply[Seq[java.io.Closeable]](scala.this.Option.option2Iterable[java.io.Closeable](SingletonConnection.this.kerberos).toSeq.++[java.io.Closeable, Seq[java.io.Closeable]](scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](SingletonConnection.this.connection))(collection.this.Seq.canBuildFrom[java.io.Closeable]))(io.this.IsCloseable.iterableIsCloseable)
239 275 10317 - 10317 Literal <nosymbol> ()
249 276 10638 - 10640 Literal <nosymbol> ()
258 277 10878 - 10880 Literal <nosymbol> ()