org.apache.hadoop.hive.common.JavaUtils Java Examples
The following examples show how to use
org.apache.hadoop.hive.common.JavaUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HiveAuthzBindingHook.java From incubator-sentry with Apache License 2.0 | 6 votes |
/** * Returns the hooks specified in a configuration variable. The hooks are returned in a list in * the order they were specified in the configuration variable. * * @param hookConfVar The configuration variable specifying a comma separated list of the hook * class names. * @return A list of the hooks, in the order they are listed in the value of hookConfVar * @throws Exception */ private static <T extends Hook> List<T> getHooks(String csHooks) throws Exception { List<T> hooks = new ArrayList<T>(); if (csHooks.isEmpty()) { return hooks; } for (String hookClass : Splitter.on(",").omitEmptyStrings().trimResults().split(csHooks)) { try { @SuppressWarnings("unchecked") T hook = (T) Class.forName(hookClass, true, JavaUtils.getClassLoader()).newInstance(); hooks.add(hook); } catch (ClassNotFoundException e) { LOG.error(hookClass + " Class not found:" + e.getMessage()); throw e; } } return hooks; }
Example #2
Source File: SentryAuthorizerUtil.java From incubator-sentry with Apache License 2.0 | 6 votes |
/** * Returns the hooks specified in a configuration variable. The hooks are returned in a list in * the order they were specified in the 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 */ public static <T extends Hook> List<T> getHooks(String csHooks, Class<T> clazz) throws Exception { List<T> hooks = new ArrayList<T>(); if (csHooks.isEmpty()) { return hooks; } for (String hookClass : Splitter.on(",").omitEmptyStrings().trimResults().split(csHooks)) { try { @SuppressWarnings("unchecked") T hook = (T) Class.forName(hookClass, true, JavaUtils.getClassLoader()).newInstance(); hooks.add(hook); } catch (ClassNotFoundException e) { LOG.error(hookClass + " Class not found:" + e.getMessage()); throw e; } } return hooks; }
Example #3
Source File: HiveS3Module.java From presto with Apache License 2.0 | 5 votes |
private static void validateEmrFsClass() { // verify that the class exists try { Class.forName(EMR_FS_CLASS_NAME, true, JavaUtils.getClassLoader()); } catch (ClassNotFoundException e) { throw new RuntimeException("EMR File System class not found: " + EMR_FS_CLASS_NAME, e); } }
Example #4
Source File: HiveDataFragmenter.java From pxf with Apache License 2.0 | 5 votes |
/** * Creates the partition InputFormat. * * @param inputFormatName input format class name * @param jobConf configuration data for the Hadoop framework * @return a {@link org.apache.hadoop.mapred.InputFormat} derived object * @throws Exception if failed to create input format */ public static InputFormat<?, ?> makeInputFormat(String inputFormatName, JobConf jobConf) throws Exception { Class<?> c = Class.forName(inputFormatName, true, JavaUtils.getClassLoader()); InputFormat<?, ?> inputFormat = (InputFormat<?, ?>) c.getDeclaredConstructor().newInstance(); if ("org.apache.hadoop.mapred.TextInputFormat".equals(inputFormatName)) { // TextInputFormat needs a special configuration ((TextInputFormat) inputFormat).configure(jobConf); } return inputFormat; }