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);
}
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);
}
Aggregations