use of org.talend.core.hadoop.IHadoopDistributionService in project tdq-studio-se by Talend.
the class AliasAndManaDriverHelper method getImpalaClassLoader.
public ClassLoader getImpalaClassLoader(IMetadataConnection metadataConn) {
IHadoopDistributionService hadoopService = getHadoopDistributionService();
if (hadoopService != null) {
String distribution = (String) metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_IMPALA_DISTRIBUTION);
String version = (String) metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_IMPALA_VERSION);
IHDistribution impalaDistribution = hadoopService.getImpalaDistributionManager().getDistribution(distribution, false);
if (impalaDistribution != null) {
String impalaIndex = EDatabaseTypeName.IMPALA.getProduct() + ClassLoaderFactory.KEY_SEPARATOR + impalaDistribution.getName();
if (impalaDistribution.useCustom()) {
String jarsStr = (String) metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CUSTOM_JARS);
// $NON-NLS-1$
String index = "CustomImpala" + ClassLoaderFactory.KEY_SEPARATOR + impalaIndex + ClassLoaderFactory.KEY_SEPARATOR + metadataConn.getId();
DynamicClassLoader classLoader = ClassLoaderFactory.getCustomClassLoader(index, jarsStr);
if (classLoader != null) {
return classLoader;
}
} else {
IHDistributionVersion impalaVersion = impalaDistribution.getHDVersion(version, false);
if (impalaVersion != null) {
boolean isKeb = Boolean.valueOf((String) metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_USE_KRB));
DynamicClassLoader classLoader = ClassLoaderFactory.getClassLoader(impalaIndex + ClassLoaderFactory.KEY_SEPARATOR + impalaVersion.getVersion() + // $NON-NLS-1$//$NON-NLS-2$
(isKeb ? "?USE_KRB" : ""));
// if not work for extension point, try modules from hadoop distribution
if (classLoader == null) {
classLoader = ClassLoaderFactory.getClassLoader(impalaVersion);
}
if (classLoader != null) {
return classLoader;
}
}
}
}
}
return this.getClass().getClassLoader();
}
use of org.talend.core.hadoop.IHadoopDistributionService in project tdq-studio-se by Talend.
the class AliasAndManaDriverHelper method getImpalaDriverJarNameList.
private List<String> getImpalaDriverJarNameList(DatabaseConnection dbConnnection) {
List<String> driverJarNameList = new ArrayList<String>();
IHadoopDistributionService hadoopService = getHadoopDistributionService();
if (hadoopService != null) {
String distribution = dbConnnection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_IMPALA_DISTRIBUTION);
String version = dbConnnection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_IMPALA_VERSION);
IHDistribution impalaDistribution = hadoopService.getImpalaDistributionManager().getDistribution(distribution, false);
if (impalaDistribution != null) {
String impalaIndex = EDatabaseTypeName.IMPALA.getProduct() + ClassLoaderFactory.KEY_SEPARATOR + impalaDistribution.getName();
if (impalaDistribution.useCustom()) {
// TODO handle custom impala here
} else {
IHDistributionVersion impalaVersion = impalaDistribution.getHDVersion(version, false);
if (impalaVersion != null) {
List<ModuleNeeded> modulesNeeded = impalaVersion.getModulesNeeded();
Set<String> libraries = new HashSet<String>();
for (ModuleNeeded m : modulesNeeded) {
libraries.add(m.getModuleName());
}
driverJarNameList.addAll(libraries);
}
}
}
}
return driverJarNameList;
}
Aggregations