/** * Returns the hooks specified in a configuration variable. * * @param hookConfVar The configuration variable specifying a comma separated list of the hook * class names. * @param clazz The super type of the hooks. * @return A list of the hooks cast as the type specified in clazz, in the order * they are listed in the value of hookConfVar * @throws Exception */ private <T extends Hook> List<T> getHooks(ConfVars hookConfVar, Class<T> clazz) throws Exception { try { return HookUtils.getHooks(conf, hookConfVar, clazz); } catch (ClassNotFoundException e) { console.printError(hookConfVar.varname + " Class not found:" + e.getMessage()); throw e; } }
public static String redactLogString(HiveConf conf, String logString) throws InstantiationException, IllegalAccessException, ClassNotFoundException { String redactedString = logString; if (conf != null && logString != null) { List<Redactor> queryRedactors = getHooks(conf, ConfVars.QUERYREDACTORHOOKS, Redactor.class); for (Redactor redactor : queryRedactors) { redactor.setConf(conf); redactedString = redactor.redactQuery(redactedString); } } return redactedString; } }
/** * Returns the hooks specified in a configuration variable. * * @param hookConfVar The configuration variable specifying a comma separated list of the hook * class names. * @param clazz The super type of the hooks. * @return A list of the hooks cast as the type specified in clazz, in the order * they are listed in the value of hookConfVar * @throws Exception */ private <T extends Hook> List<T> getHooks(ConfVars hookConfVar, Class<T> clazz) throws Exception { try { return HookUtils.getHooks(conf, hookConfVar, clazz); } catch (ClassNotFoundException e) { console.printError(hookConfVar.varname + " Class not found:" + e.getMessage()); throw e; } }
private void executeSessionHooks(HiveSession session) throws Exception { List<HiveSessionHook> sessionHooks = HookUtils.getHooks(hiveConf, HiveConf.ConfVars.HIVE_SERVER2_SESSION_HOOK, HiveSessionHook.class); for (HiveSessionHook sessionHook : sessionHooks) { sessionHook.run(new HiveSessionHookContextImpl(session)); } }
private void executeSessionHooks(HiveSession session) throws Exception { List<HiveSessionHook> sessionHooks = HookUtils.getHooks(hiveConf, HiveConf.ConfVars.HIVE_SERVER2_SESSION_HOOK, HiveSessionHook.class); for (HiveSessionHook sessionHook : sessionHooks) { sessionHook.run(new HiveSessionHookContextImpl(session)); } }
public static String redactLogString(HiveConf conf, String logString) throws InstantiationException, IllegalAccessException, ClassNotFoundException { String redactedString = logString; if (conf != null && logString != null) { List<Redactor> queryRedactors = getHooks(conf, ConfVars.QUERYREDACTORHOOKS, Redactor.class); for (Redactor redactor : queryRedactors) { redactor.setConf(conf); redactedString = redactor.redactQuery(redactedString); } } return redactedString; } }