hive插件 ranger_阅读ranger-hive-plugin源码

首先ranger和hive是通过在hive中配置hive.security.authorization.manager参数,建立起的联系

在hive的lib目录下存在ranger-plugin-classloader-0.5.0.2.4.0.0-169.jar、ranger-hive-plugin-shim-0.5.0.2.4.0.0-169.jar这两jar包以及ranger-hive-plugin-impl目录

当实例化hive.security.authorization.manager指定的类时(org.apache.ranger.authorization.hive.authorizer.RangerHiveAuthorizerFactory),也就是调用RangerHiveAuthorizerFactory的构造方法时,会调用RangerHiveAuthorizerFactory的init()方法;在RangerHiveAuthorizerFactory的init()中,会调用ranger-plugin-classloader-0.5.0.2.4.0.0-169.jar包中的RangerPluginClassLoader的getInstance方法,来获取自定义的URLClassLoader;在ranger-plugin-classloader-0.5.0.2.4.0.0-169.jar包中实现了RangerPluginClassLoader类,该类继承自URLClassLoader;使用RangerPluginClassLoaderUtil类getPluginFilesForServiceTypeAndPluginclass方法,根据组件名生成路径(路径如:/usr/hdp/2.4.0.0-169/hive/lib/ranger-hive-plugin-impl);然后获取该路径(/usr/hdp/2.4.0.0-169/hive/lib/ranger-hive-plugin-impl)下的所有jar包的URL

[file:/usr/hdp/2.4.0.0-169/hive/lib/ranger-hive-plugin-impl/ranger-plugins-cred-0.5.0.2.4.0.0-169.jar, file:/usr/hdp/2.4.0.0-169/hive/lib/ranger-hive-plugin-impl/noggit-0.6.jar, file:/usr/hdp/2.4.0.0-169/hive/lib/ranger-hive-plugin-impl/eclipselink-2.5.2-M1.jar, file:/usr/hdp/2.4.0.0-169/hive/lib/ranger-hive-plugin-impl/ranger_solrj-0.5.0.2.4.0.0-169.jar, file:/usr/hdp/2.4.0.0-169/hive/lib/ranger-hive-plugin-impl/ranger-plugins-audit-0.5.0.2.4.0.0-169.jar, file:/usr/hdp/2.4.0.0-169/hive/lib/ranger-hive-plugin-impl/httpmime-4.2.5.jar, file:/usr/hdp/2.4.0.0-169/hive/lib/ranger-hive-plugin-impl/gson-2.2.4.jar, file:/usr/hdp/2.4.0.0-169/hive/lib/ranger-hive-plugin-impl/javax.persistence-2.1.0.jar, file:/usr/hdp/2.4.0.0-169/hive/lib/ranger-hive-plugin-impl/ranger-hive-plugin-0.5.0.2.4.0.0-169.jar, file:/usr/hdp/2.4.0.0-169/hive/lib/ranger-hive-plugin-impl/ranger-plugins-common-0.5.0.2.4.0.0-169.jar]

调用super方法,将这些jar包的URL传入URLClassLoader子类中,并返回RangerPluginClassLoader实例(在RangerPluginClassLoader类中实现了findClass、loadClass、findResource、findResources方法)

注意:本文归作者所有,未经作者允许,不得转载

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值