Search in sources :

Example 1 with DynamicDistributionManager

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);
        }
    }
}
Also used : DynamicDistributionManager(org.talend.hadoop.distribution.dynamic.DynamicDistributionManager) IDynamicPlugin(org.talend.core.runtime.dynamic.IDynamicPlugin) DummyDynamicMonitor(org.talend.designer.maven.aether.DummyDynamicMonitor) IDynamicPluginConfiguration(org.talend.core.runtime.dynamic.IDynamicPluginConfiguration) IDynamicMonitor(org.talend.designer.maven.aether.IDynamicMonitor) LinkedList(java.util.LinkedList)

Example 2 with DynamicDistributionManager

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);
}
Also used : DynamicConfiguration(org.talend.hadoop.distribution.dynamic.DynamicConfiguration) IDynamicExtension(org.talend.core.runtime.dynamic.IDynamicExtension) DynamicDistributionManager(org.talend.hadoop.distribution.dynamic.DynamicDistributionManager) TemplateBean(org.talend.hadoop.distribution.dynamic.bean.TemplateBean) IDynamicPluginConfiguration(org.talend.core.runtime.dynamic.IDynamicPluginConfiguration) IDependencyResolver(org.talend.hadoop.distribution.dynamic.resolver.IDependencyResolver)

Example 3 with DynamicDistributionManager

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);
    }
}
Also used : IDynamicDistributionsGroup(org.talend.hadoop.distribution.dynamic.IDynamicDistributionsGroup) DynamicDistributionManager(org.talend.hadoop.distribution.dynamic.DynamicDistributionManager) ArrayList(java.util.ArrayList) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) LoginException(org.talend.commons.exception.LoginException) InvocationTargetException(java.lang.reflect.InvocationTargetException) PersistenceException(org.talend.commons.exception.PersistenceException)

Example 4 with DynamicDistributionManager

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);
    }
}
Also used : DynamicConfiguration(org.talend.hadoop.distribution.dynamic.DynamicConfiguration) DynamicDistributionManager(org.talend.hadoop.distribution.dynamic.DynamicDistributionManager) Test(org.junit.Test)

Example 5 with DynamicDistributionManager

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);
    }
}
Also used : DynamicConfiguration(org.talend.hadoop.distribution.dynamic.DynamicConfiguration) DynamicDistributionManager(org.talend.hadoop.distribution.dynamic.DynamicDistributionManager) Test(org.junit.Test)

Aggregations

DynamicDistributionManager (org.talend.hadoop.distribution.dynamic.DynamicDistributionManager)6 DynamicConfiguration (org.talend.hadoop.distribution.dynamic.DynamicConfiguration)4 Test (org.junit.Test)3 IDynamicPluginConfiguration (org.talend.core.runtime.dynamic.IDynamicPluginConfiguration)2 TemplateBean (org.talend.hadoop.distribution.dynamic.bean.TemplateBean)2 IDependencyResolver (org.talend.hadoop.distribution.dynamic.resolver.IDependencyResolver)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 LoginException (org.talend.commons.exception.LoginException)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 IDynamicConfiguration (org.talend.core.runtime.dynamic.IDynamicConfiguration)1 IDynamicExtension (org.talend.core.runtime.dynamic.IDynamicExtension)1 IDynamicPlugin (org.talend.core.runtime.dynamic.IDynamicPlugin)1 DummyDynamicMonitor (org.talend.designer.maven.aether.DummyDynamicMonitor)1 IDynamicMonitor (org.talend.designer.maven.aether.IDynamicMonitor)1 IDynamicDistributionsGroup (org.talend.hadoop.distribution.dynamic.IDynamicDistributionsGroup)1