Search in sources :

Example 6 with IDependencyResolver

use of org.talend.hadoop.distribution.dynamic.resolver.IDependencyResolver 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 7 with IDependencyResolver

use of org.talend.hadoop.distribution.dynamic.resolver.IDependencyResolver in project tbd-studio-se by Talend.

the class DynamicModuleAdapterTest method testAdapt.

@Test
public void testAdapt() throws Exception {
    TemplateBean templateBean = new TemplateBean();
    // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
    ModuleBean moduleBean = new ModuleBean(ModuleBean.TYPE_BASE, "org.apache.hive", "hive-jdbc", "2.1.0.2.6.5.5000-33");
    DynamicDistributionManager dynamicDistributionManager = DynamicDistributionManager.getInstance();
    DynamicConfiguration configuration = new DynamicConfiguration();
    // $NON-NLS-1$
    configuration.setDistribution("HORTONWORKS");
    // $NON-NLS-1$
    configuration.setVersion("2.6.5.5000-33");
    IDependencyResolver dependencyResolver = dynamicDistributionManager.getDependencyResolver(configuration);
    Set<String> registeredModules = new HashSet<String>();
    DynamicModuleAdapter dynamicModuleAdapter = new DynamicModuleAdapter(templateBean, configuration, moduleBean, dependencyResolver, registeredModules);
    List<IDynamicConfiguration> librariesNeeded = dynamicModuleAdapter.adapt(null, false);
    librariesNeeded.stream().forEach(l -> System.out.println(l.toString()));
    Assert.assertTrue(librariesNeeded.size() > 1);
}
Also used : IDynamicConfiguration(org.talend.core.runtime.dynamic.IDynamicConfiguration) IDynamicConfiguration(org.talend.core.runtime.dynamic.IDynamicConfiguration) DynamicConfiguration(org.talend.hadoop.distribution.dynamic.DynamicConfiguration) DynamicDistributionManager(org.talend.hadoop.distribution.dynamic.DynamicDistributionManager) ModuleBean(org.talend.hadoop.distribution.dynamic.bean.ModuleBean) TemplateBean(org.talend.hadoop.distribution.dynamic.bean.TemplateBean) IDependencyResolver(org.talend.hadoop.distribution.dynamic.resolver.IDependencyResolver) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

IDependencyResolver (org.talend.hadoop.distribution.dynamic.resolver.IDependencyResolver)7 HashSet (java.util.HashSet)4 LinkedList (java.util.LinkedList)3 VersionStringComparator (org.talend.designer.maven.aether.comparator.VersionStringComparator)3 DynamicConfiguration (org.talend.hadoop.distribution.dynamic.DynamicConfiguration)3 TemplateBean (org.talend.hadoop.distribution.dynamic.bean.TemplateBean)3 DynamicDistributionManager (org.talend.hadoop.distribution.dynamic.DynamicDistributionManager)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Test (org.junit.Test)1 LoginException (org.talend.commons.exception.LoginException)1 PersistenceException (org.talend.commons.exception.PersistenceException)1