@SuppressWarnings("unchecked") CustomAuthenticationProviderImpl(HiveConf conf) { Class<? extends PasswdAuthenticationProvider> customHandlerClass = (Class<? extends PasswdAuthenticationProvider>) conf.getClass( HiveConf.ConfVars.HIVE_SERVER2_CUSTOM_AUTHENTICATION_CLASS.varname, PasswdAuthenticationProvider.class); PasswdAuthenticationProvider customProvider; try { customProvider = customHandlerClass.getConstructor(HiveConf.class).newInstance(conf); } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) { customProvider = ReflectionUtils.newInstance(customHandlerClass, conf); } this.customProvider = customProvider; }
private HiveAuthorizationTaskFactory createAuthorizationTaskFactory(HiveConf conf, Hive db) { Class<? extends HiveAuthorizationTaskFactory> authProviderClass = conf. getClass(HiveConf.ConfVars.HIVE_AUTHORIZATION_TASK_FACTORY.varname, HiveAuthorizationTaskFactoryImpl.class, HiveAuthorizationTaskFactory.class); String msg = "Unable to create instance of " + authProviderClass.getName() + ": "; try { Constructor<? extends HiveAuthorizationTaskFactory> constructor = authProviderClass.getConstructor(HiveConf.class, Hive.class); return constructor.newInstance(conf, db); } catch (NoSuchMethodException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (SecurityException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (InstantiationException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (IllegalAccessException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (IllegalArgumentException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (InvocationTargetException e) { throw new IllegalStateException(msg + e.getMessage(), e); } }
private HiveAuthorizationTaskFactory createAuthorizationTaskFactory(HiveConf conf, Hive db) { Class<? extends HiveAuthorizationTaskFactory> authProviderClass = conf. getClass(HiveConf.ConfVars.HIVE_AUTHORIZATION_TASK_FACTORY.varname, HiveAuthorizationTaskFactoryImpl.class, HiveAuthorizationTaskFactory.class); String msg = "Unable to create instance of " + authProviderClass.getName() + ": "; try { Constructor<? extends HiveAuthorizationTaskFactory> constructor = authProviderClass.getConstructor(HiveConf.class, Hive.class); return constructor.newInstance(conf, db); } catch (NoSuchMethodException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (SecurityException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (InstantiationException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (IllegalAccessException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (IllegalArgumentException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (InvocationTargetException e) { throw new IllegalStateException(msg + e.getMessage(), e); } }
public DataCompletenessChecker getCompletenessChecker() { if (completenessChecker == null) { completenessChecker = ReflectionUtils.newInstance(config.getClass(LensConfConstants.COMPLETENESS_CHECKER_CLASS, LensConfConstants.DEFAULT_COMPLETENESS_CHECKER, DataCompletenessChecker.class), this.config); } return completenessChecker; }
public DataCompletenessChecker getCompletenessChecker() { if (completenessChecker == null) { completenessChecker = ReflectionUtils.newInstance(config.getClass(LensConfConstants.COMPLETENESS_CHECKER_CLASS, LensConfConstants.DEFAULT_COMPLETENESS_CHECKER, DataCompletenessChecker.class), this.config); } return completenessChecker; }
@SuppressWarnings("unchecked") CustomAuthenticationProviderImpl(HiveConf conf) { Class<? extends PasswdAuthenticationProvider> customHandlerClass = (Class<? extends PasswdAuthenticationProvider>) conf.getClass( HiveConf.ConfVars.HIVE_SERVER2_CUSTOM_AUTHENTICATION_CLASS.varname, PasswdAuthenticationProvider.class); PasswdAuthenticationProvider customProvider; try { customProvider = customHandlerClass.getConstructor(HiveConf.class).newInstance(conf); } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) { customProvider = ReflectionUtils.newInstance(customHandlerClass, conf); } this.customProvider = customProvider; }
/** * Gets the service provider factory. * * @param conf the conf * @return the service provider factory */ private ServiceProviderFactory getServiceProviderFactory(HiveConf conf) { Class<?> spfClass = conf.getClass(LensConfConstants.SERVICE_PROVIDER_FACTORY, ServiceProviderFactory.class); try { return (ServiceProviderFactory) spfClass.newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
/** * Gets the service provider factory. * * @param conf the conf * @return the service provider factory */ private ServiceProviderFactory getServiceProviderFactory(HiveConf conf) { Class<?> spfClass = conf.getClass(LensConfConstants.SERVICE_PROVIDER_FACTORY, ServiceProviderFactory.class); try { return (ServiceProviderFactory) spfClass.newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
@SuppressWarnings("unchecked") CustomAuthenticationProviderImpl() { HiveConf conf = new HiveConf(); Class<? extends PasswdAuthenticationProvider> customHandlerClass = (Class<? extends PasswdAuthenticationProvider>) conf.getClass( HiveConf.ConfVars.HIVE_SERVER2_CUSTOM_AUTHENTICATION_CLASS.varname, PasswdAuthenticationProvider.class); customProvider = ReflectionUtils.newInstance(customHandlerClass, conf); }
@SuppressWarnings("unchecked") CustomAuthenticationProviderImpl() { HiveConf conf = new HiveConf(); Class<? extends PasswdAuthenticationProvider> customHandlerClass = (Class<? extends PasswdAuthenticationProvider>) conf.getClass( HiveConf.ConfVars.HIVE_SERVER2_CUSTOM_AUTHENTICATION_CLASS.varname, PasswdAuthenticationProvider.class); customProvider = ReflectionUtils.newInstance(customHandlerClass, conf); }
public static ServiceProvider getServiceProvider() throws Exception { Class<? extends ServiceProviderFactory> spfClass = HIVE_CONF.getClass(LensConfConstants.SERVICE_PROVIDER_FACTORY, null, ServiceProviderFactory.class); ServiceProviderFactory spf = spfClass.newInstance(); return spf.getServiceProvider(); } }
@SuppressWarnings("unchecked") CustomAuthenticationProviderImpl() { HiveConf conf = new HiveConf(); Class<? extends PasswdAuthenticationProvider> customHandlerClass = (Class<? extends PasswdAuthenticationProvider>) conf.getClass( HiveConf.ConfVars.HIVE_SERVER2_CUSTOM_AUTHENTICATION_CLASS.varname, PasswdAuthenticationProvider.class); customProvider = ReflectionUtils.newInstance(customHandlerClass, conf); }
@SuppressWarnings("unchecked") CustomAuthenticationProviderImpl() { HiveConf conf = new HiveConf(); Class<? extends PasswdAuthenticationProvider> customHandlerClass = (Class<? extends PasswdAuthenticationProvider>) conf.getClass( HiveConf.ConfVars.HIVE_SERVER2_CUSTOM_AUTHENTICATION_CLASS.varname, PasswdAuthenticationProvider.class); customProvider = ReflectionUtils.newInstance(customHandlerClass, conf); }
private MetaStoreFilterHook loadFilterHooks() throws IllegalStateException { Class<? extends MetaStoreFilterHook> authProviderClass = conf. getClass(HiveConf.ConfVars.METASTORE_FILTER_HOOK.varname, DefaultMetaStoreFilterHookImpl.class, MetaStoreFilterHook.class); String msg = "Unable to create instance of " + authProviderClass.getName() + ": "; try { Constructor<? extends MetaStoreFilterHook> constructor = authProviderClass.getConstructor(HiveConf.class); return constructor.newInstance(conf); } catch (NoSuchMethodException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (SecurityException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (InstantiationException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (IllegalAccessException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (IllegalArgumentException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (InvocationTargetException e) { throw new IllegalStateException(msg + e.getMessage(), e); } }
private HiveAuthorizationTaskFactory createAuthorizationTaskFactory(HiveConf conf, Hive db) { Class<? extends HiveAuthorizationTaskFactory> authProviderClass = conf. getClass(HiveConf.ConfVars.HIVE_AUTHORIZATION_TASK_FACTORY.varname, HiveAuthorizationTaskFactoryImpl.class, HiveAuthorizationTaskFactory.class); String msg = "Unable to create instance of " + authProviderClass.getName() + ": "; try { Constructor<? extends HiveAuthorizationTaskFactory> constructor = authProviderClass.getConstructor(HiveConf.class, Hive.class); return constructor.newInstance(conf, db); } catch (NoSuchMethodException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (SecurityException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (InstantiationException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (IllegalAccessException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (IllegalArgumentException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (InvocationTargetException e) { throw new IllegalStateException(msg + e.getMessage(), e); } }
private MetaStoreFilterHook loadFilterHooks() throws IllegalStateException { Class<? extends MetaStoreFilterHook> authProviderClass = conf. getClass(HiveConf.ConfVars.METASTORE_FILTER_HOOK.varname, DefaultMetaStoreFilterHookImpl.class, MetaStoreFilterHook.class); String msg = "Unable to create instance of " + authProviderClass.getName() + ": "; try { Constructor<? extends MetaStoreFilterHook> constructor = authProviderClass.getConstructor(HiveConf.class); return constructor.newInstance(conf); } catch (NoSuchMethodException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (SecurityException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (InstantiationException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (IllegalAccessException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (IllegalArgumentException e) { throw new IllegalStateException(msg + e.getMessage(), e); } catch (InvocationTargetException e) { throw new IllegalStateException(msg + e.getMessage(), e); } }
/** * Gets the query user resolver. * * @param groupType the resolver type * @return the query user resolver */ public static UserGroupConfigLoader createUserGroupConfigLoader(GroupType groupType) { switch (groupType) { case CUSTOM: try { return (conf.getClass(USER_GROUP_CUSTOM_CLASS, UserGroupConfigLoader.class, UserGroupConfigLoader.class)) .getConstructor(HiveConf.class).newInstance(conf); } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException | InstantiationException e) { throw new UserGroupLoaderException(e); } case FIXED: default: return new FixedUserGroupConfigLoader(conf); } }
/** * Gets the query user resolver. * * @param resolverType the resolver type * @return the query user resolver */ public static UserConfigLoader createUserConfigLoader(ResolverType resolverType) { switch (resolverType) { case PROPERTYBASED: return new PropertyBasedUserConfigLoader(conf); case DATABASE: return new DatabaseUserConfigLoader(conf); case LDAP_BACKED_DATABASE: return new LDAPBackedDatabaseUserConfigLoader(conf); case CUSTOM: try { return (conf.getClass(USER_RESOLVER_CUSTOM_CLASS, UserConfigLoader.class, UserConfigLoader.class)) .getConstructor(HiveConf.class).newInstance(conf); } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException | InstantiationException e) { throw new UserConfigLoaderException(e); } case FIXED: default: return new FixedUserConfigLoader(conf); } }
/** * Test service provider. * * @throws Exception the exception */ @Test public void testServiceProvider() throws Exception { HiveConf conf = LensServerConf.getHiveConf(); Class<? extends ServiceProviderFactory> spfClass = conf.getClass(LensConfConstants.SERVICE_PROVIDER_FACTORY, null, ServiceProviderFactory.class); ServiceProviderFactory spf = spfClass.newInstance(); ServiceProvider serviceProvider = spf.getServiceProvider(); Assert.assertNotNull(serviceProvider); Assert.assertTrue(serviceProvider instanceof LensServices); QueryExecutionService querySvc = serviceProvider.getService(QueryExecutionService.NAME); Assert.assertNotNull(querySvc); LensEventService eventSvc = serviceProvider.getService(LensEventService.NAME); Assert.assertNotNull(eventSvc); } }