@Override public Class<?> getClassByName(String name) throws ClassNotFoundException { return encapsulated.getClassByName(name); }
@Override public Class<?> getClassByName(String name) throws ClassNotFoundException { return encapsulated.getClassByName(name); }
@Override public Class<?> getClassByName(String name) throws ClassNotFoundException { return c.getClassByName(name); }
@Override public Class<?> getClassByName(String name) throws ClassNotFoundException { return conf.getClassByName(name); }
private Method getFactoryMethod(String className, Configuration conf) throws Exception { Class<?> clazz = conf.getClassByName(className); return clazz.getMethod("parseFrom", byte[].class); } }
private static AWSCredentialsProvider getCustomAWSCredentialsProvider(Configuration conf, String providerClass) { try { return conf.getClassByName(providerClass) .asSubclass(AWSCredentialsProvider.class) .getConstructor(URI.class, Configuration.class) .newInstance(null, conf); } catch (ReflectiveOperationException e) { throw new RuntimeException(format("Error creating an instance of %s", providerClass), e); } }
static Class<?> getProtocolClass(String protocolName, Configuration conf) throws ClassNotFoundException { Class<?> protocol = PROTOCOL_CACHE.get(protocolName); if (protocol == null) { protocol = conf.getClassByName(protocolName); PROTOCOL_CACHE.put(protocolName, protocol); } return protocol; }
private static AWSCredentialsProvider getCustomAWSCredentialsProvider(URI uri, Configuration conf, String providerClass) { try { log.debug("Using AWS credential provider %s for URI %s", providerClass, uri); return conf.getClassByName(providerClass) .asSubclass(AWSCredentialsProvider.class) .getConstructor(URI.class, Configuration.class) .newInstance(uri, conf); } catch (ReflectiveOperationException e) { throw new RuntimeException(format("Error creating an instance of %s for URI %s", providerClass, uri), e); } }
public static Class<?> getDataWriteSupportClass(JobContext context) { String className = context.getConfiguration().get(PinotOutputFormat.PINOT_RECORD_SERIALIZATION_CLASS); if (className == null) { throw new RuntimeException("pinot data write support class not set"); } try { return context.getConfiguration().getClassByName(className); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
private static Class<?> loadClass(String className, @Nullable Configuration configuration) throws Exception { if (configuration != null) { return configuration.getClassByName(className); } return JavaUtils.loadClass(className); }
/** * Get the value of the <code>name</code> property as a <code>Class</code>. * If no such property is specified, then <code>defaultValue</code> is * returned. * * @param name the class name. * @param defaultValue default value. * @return property value as a <code>Class</code>, * or <code>defaultValue</code>. */ public Class<?> getClass(String name, Class<?> defaultValue) { String valueString = getTrimmed(name); if (valueString == null) return defaultValue; try { return getClassByName(valueString); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
/** * Get the value of the <code>name</code> property as a <code>Class</code>. * If no such property is specified, then <code>defaultValue</code> is * returned. * * @param name the class name. * @param defaultValue default value. * @return property value as a <code>Class</code>, * or <code>defaultValue</code>. */ public Class<?> getClass(String name, Class<?> defaultValue) { String valueString = getTrimmed(name); if (valueString == null) return defaultValue; try { return getClassByName(valueString); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
/** * Get a class fromt the configuration * @param name the class name * @return the class * @throws ClassNotFoundException if the class was not found * @throws Error on other classloading problems */ private Class getClass(String name) throws ClassNotFoundException { return getConf().getClassByName(name); }
@SuppressWarnings("unchecked") private void add(Configuration conf, String serializationName) { try { Class<? extends Serialization> serializionClass = (Class<? extends Serialization>) conf.getClassByName(serializationName); serializations.add((Serialization) ReflectionUtils.newInstance(serializionClass, getConf())); } catch (ClassNotFoundException e) { LOG.warn("Serialization class not found: ", e); } }
private Class<?> readClass(DataInput in) throws IOException { String className = Text.readString(in); try { return conf.getClassByName(className); } catch (ClassNotFoundException e) { throw new RuntimeException("readObject can't find class", e); } }
@Override public void readFields(DataInput in) throws IOException { String inputSplitClassName = in.readUTF(); try { inputSplit = (InputSplit) ReflectionUtil.newInstance(conf .getClassByName(inputSplitClassName), conf); } catch (Exception e) { throw new IOException( "Cannot create an instance of InputSplit class = " + inputSplitClassName + ":" + e.getMessage(), e); } inputSplit.readFields(in); inputFormatClassName = in.readUTF(); }
public static Class<? extends Deserializer> getDeserializerClass( Configuration conf, org.apache.hadoop.hive.metastore.api.Table table) throws Exception { String lib = table.getSd().getSerdeInfo().getSerializationLib(); return lib == null ? null : conf.getClassByName(lib).asSubclass(Deserializer.class); }
@Test public void testConstructor() { String className = MetastoreConf.getVar(conf, ConfVars.SCHEMA_INFO_CLASS, MetaStoreSchemaInfo.class.getCanonicalName()); Class<?> clasz = null; try { clasz = conf.getClassByName(className); clasz.getConstructor(String.class, String.class); } catch (NoSuchMethodException | IllegalArgumentException | ClassNotFoundException e) { throw new IllegalArgumentException(e); } }
/** * Return a deserializer object corresponding to the partitionDesc. */ public Deserializer getDeserializer(Configuration conf) throws Exception { Properties schema = getProperties(); String clazzName = getDeserializerClassName(); Deserializer deserializer = ReflectionUtil.newInstance(conf.getClassByName(clazzName) .asSubclass(Deserializer.class), conf); SerDeUtils.initializeSerDe(deserializer, conf, getTableDesc().getProperties(), schema); return deserializer; }
/** * Return a deserializer object corresponding to the partitionDesc. */ public Deserializer getDeserializer(Configuration conf) throws Exception { Properties schema = getProperties(); String clazzName = getDeserializerClassName(); Deserializer deserializer = ReflectionUtil.newInstance(conf.getClassByName(clazzName) .asSubclass(Deserializer.class), conf); SerDeUtils.initializeSerDe(deserializer, conf, getTableDesc().getProperties(), schema); return deserializer; }