use of org.talend.hadoop.distribution.dynamic.DynamicDistributionManager in project tbd-studio-se by Talend.
the class DynamicDistributionOptionForm method initExistingConfigurationInfos.
private void initExistingConfigurationInfos() throws Exception {
existingConfigurationNames = new HashSet<>();
existingConfigurationIdMap = new HashMap<>();
IDynamicMonitor monitor = new DummyDynamicMonitor();
DynamicDistributionManager dynDistrManager = DynamicDistributionManager.getInstance();
List<IDynamicPlugin> allDynamicPlugins = new LinkedList<>();
List<IDynamicPlugin> allBuiltinDynamicPlugins = dynDistrManager.getAllBuiltinDynamicPlugins(monitor);
if (allBuiltinDynamicPlugins != null && !allBuiltinDynamicPlugins.isEmpty()) {
allDynamicPlugins.addAll(allBuiltinDynamicPlugins);
}
List<IDynamicPlugin> allUsesDynamicPlugins = dynDistrManager.getAllUsersDynamicPlugins(monitor);
if (allUsesDynamicPlugins != null && !allUsesDynamicPlugins.isEmpty()) {
allDynamicPlugins.addAll(allUsesDynamicPlugins);
}
if (allDynamicPlugins != null && !allDynamicPlugins.isEmpty()) {
Iterator<IDynamicPlugin> iter = allDynamicPlugins.iterator();
while (iter.hasNext()) {
IDynamicPlugin dynPlugin = iter.next();
IDynamicPluginConfiguration pluginConfiguration = dynPlugin.getPluginConfiguration();
existingConfigurationNames.add(pluginConfiguration.getName());
existingConfigurationIdMap.put(pluginConfiguration.getId(), dynPlugin);
}
}
}
use of org.talend.hadoop.distribution.dynamic.DynamicDistributionManager in project tbd-studio-se by Talend.
the class DynamicTemplateAdapter method adapt.
public void adapt(IDynamicMonitor monitor) throws Exception {
DynamicDistributionUtils.checkCancelOrNot(monitor);
resolve();
TemplateBean templateBean = getTemplateBean();
DynamicConfiguration configuration = getConfiguration();
// use id instead of version
templateBean.setDynamicVersion(configuration.getId());
DynamicDistributionManager dynamicDistributionManager = DynamicDistributionManager.getInstance();
IDependencyResolver dependencyResolver = dynamicDistributionManager.getDependencyResolver(configuration);
dynamicPlugin = DynamicFactory.getInstance().createDynamicPlugin();
distriConfigAdapter = new DynamicDistribConfigAdapter(templateBean, configuration);
IDynamicPluginConfiguration pluginConfiguration = distriConfigAdapter.adapt(monitor);
dynamicPlugin.setPluginConfiguration(pluginConfiguration);
moduleBeanAdapterMap = new HashMap<>();
moduleGroupBeanAdapterMap = new HashMap<>();
DynamicLibraryNeededExtensionAdaper libNeededExtAdapter = new DynamicLibraryNeededExtensionAdaper(templateBean, configuration, dependencyResolver, moduleBeanAdapterMap, moduleGroupBeanAdapterMap);
libNeededExtAdapter.enableMultiThread(!Boolean.getBoolean(PROPERTY_DISABLE_MULTI_THTREAD));
IDynamicExtension dynamicLibNeededExtension = libNeededExtAdapter.adapt(monitor);
dynamicPlugin.addExtension(dynamicLibNeededExtension);
DynamicClassLoaderExtensionAdaper clsLoaderAdapter = new DynamicClassLoaderExtensionAdaper(templateBean, configuration, moduleGroupBeanAdapterMap);
IDynamicExtension dynamicClsLoaderExtension = clsLoaderAdapter.adapt(monitor);
dynamicPlugin.addExtension(dynamicClsLoaderExtension);
}
use of org.talend.hadoop.distribution.dynamic.DynamicDistributionManager in project tbd-studio-se by Talend.
the class DynamicDistributionPreferenceForm method loadData.
private void loadData(IDynamicMonitor monitor) {
try {
DynamicDistributionManager dynDistriManager = DynamicDistributionManager.getInstance();
List<IDynamicDistributionsGroup> dynDistriGroups = dynDistriManager.getDynamicDistributionsGroups();
if (dynDistriGroups != null && !dynDistriGroups.isEmpty()) {
List<String> distributionDisplayNames = new ArrayList<>();
for (IDynamicDistributionsGroup dynDistriGroup : dynDistriGroups) {
String displayName = dynDistriGroup.getDistributionDisplay();
distributionDisplayNames.add(displayName);
}
Collections.sort(distributionDisplayNames);
if (ITalendCorePrefConstants.DYNAMIC_DISTRIBUTION_SETTING == showPart) {
distributionCombo.setInput(distributionDisplayNames);
} else {
setupDistriCombo.setInput(distributionDisplayNames);
}
if (0 < distributionDisplayNames.size()) {
if (ITalendCorePrefConstants.DYNAMIC_DISTRIBUTION_SETTING == showPart) {
distributionCombo.setSelection(new StructuredSelection(distributionDisplayNames.get(0)));
refreshVersionList(monitor);
} else {
setupDistriCombo.setSelection(new StructuredSelection(distributionDisplayNames.get(0)));
}
}
}
if (ITalendCorePrefConstants.DYNAMIC_DISTRIBUTION_SETTING != showPart) {
loadRepositorySetupGroup();
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
use of org.talend.hadoop.distribution.dynamic.DynamicDistributionManager in project tbd-studio-se by Talend.
the class AbstractDependencyResolverTest method testGetDependencyVersionByHadoopVersionHortonworks.
@Test
public void testGetDependencyVersionByHadoopVersionHortonworks() throws Exception {
DynamicDistributionManager dynamicDistributionManager = DynamicDistributionManager.getInstance();
DynamicConfiguration configuration = new DynamicConfiguration();
// $NON-NLS-1$
configuration.setDistribution("HORTONWORKS");
// $NON-NLS-1$ //$NON-NLS-2$
List<String> hadoopVersions = Arrays.asList("3.1.4.12-1");
for (String hadoopVersion : hadoopVersions) {
configuration.setVersion(hadoopVersion);
IDependencyResolver dependencyResolver = dynamicDistributionManager.getDependencyResolver(configuration);
String sparkYarnVersion = // $NON-NLS-1$
dependencyResolver.getDependencyVersionByHadoopVersion(// $NON-NLS-1$
"org.apache.spark", // $NON-NLS-1$
"spark-yarn_2.11", null);
Assert.assertNotNull(sparkYarnVersion);
// $NON-NLS-1$ //$NON-NLS-2$
String hiveJdbcVersion = dependencyResolver.getDependencyVersionByHadoopVersion("org.apache.hive", "hive-jdbc", null);
Assert.assertNotNull(hiveJdbcVersion);
}
}
use of org.talend.hadoop.distribution.dynamic.DynamicDistributionManager in project tbd-studio-se by Talend.
the class AbstractDependencyResolverTest method testGetDependencyVersionByHadoopVersionCdp.
@Test
public void testGetDependencyVersionByHadoopVersionCdp() throws Exception {
DynamicDistributionManager dynamicDistributionManager = DynamicDistributionManager.getInstance();
DynamicConfiguration configuration = new DynamicConfiguration();
// $NON-NLS-1$
configuration.setDistribution("CDP");
// $NON-NLS-1$
List<String> hadoopVersions = Arrays.asList("7.1.0.2-7");
for (String hadoopVersion : hadoopVersions) {
configuration.setVersion(hadoopVersion);
IDependencyResolver dependencyResolver = dynamicDistributionManager.getDependencyResolver(configuration);
String sparkYarnVersion = // $NON-NLS-1$
dependencyResolver.getDependencyVersionByHadoopVersion(// $NON-NLS-1$
"org.apache.spark", // $NON-NLS-1$
"spark-yarn_2.11", null);
Assert.assertNotNull(sparkYarnVersion);
}
}
Aggregations