Search in sources :

Example 6 with IDynamicPluginConfiguration

use of org.talend.core.runtime.dynamic.IDynamicPluginConfiguration in project tbd-studio-se by Talend.

the class DynamicSparkBatchModuleGroupTemplate method getNodeModuleGroups.

@Override
public Map<NodeComponentTypeBean, Set<DistributionModuleGroup>> getNodeModuleGroups() throws Exception {
    Map<NodeComponentTypeBean, Set<DistributionModuleGroup>> nodeModuleGroups = super.getNodeModuleGroups();
    DynamicPluginAdapter pluginAdapter = getPluginAdapter();
    IDynamicPluginConfiguration configuration = pluginAdapter.getPluginConfiguration();
    String distribution = configuration.getDistribution();
    String version = configuration.getId();
    buildNodeModuleGroups4SparkBatch(pluginAdapter, nodeModuleGroups, distribution, version);
    return nodeModuleGroups;
}
Also used : Set(java.util.Set) DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) NodeComponentTypeBean(org.talend.hadoop.distribution.NodeComponentTypeBean) IDynamicPluginConfiguration(org.talend.core.runtime.dynamic.IDynamicPluginConfiguration)

Example 7 with IDynamicPluginConfiguration

use of org.talend.core.runtime.dynamic.IDynamicPluginConfiguration in project tbd-studio-se by Talend.

the class DynamicDistributionManager method getUsersIdDynamicDistributionMap.

private Map<String, IDynamicPlugin> getUsersIdDynamicDistributionMap() throws Exception {
    if (usersIdDistributionMap != null) {
        String systemCacheVersion = HadoopDistributionsHelper.getCacheVersion();
        if (StringUtils.equals(systemCacheVersion, usersIdDistributionMapCacheVersion)) {
            return usersIdDistributionMap;
        }
    }
    usersIdDistributionMap = new HashMap<>();
    usersIdDistributionMapCacheVersion = HadoopDistributionsHelper.getCacheVersion();
    IDynamicMonitor monitor = new DummyDynamicMonitor();
    List<IDynamicPlugin> allBuiltinDynamicPlugins = getAllUsersDynamicPlugins(monitor);
    if (allBuiltinDynamicPlugins != null && !allBuiltinDynamicPlugins.isEmpty()) {
        for (IDynamicPlugin dynamicPlugin : allBuiltinDynamicPlugins) {
            IDynamicPluginConfiguration pluginConfiguration = dynamicPlugin.getPluginConfiguration();
            if (pluginConfiguration != null) {
                String id = pluginConfiguration.getId();
                usersIdDistributionMap.put(id, dynamicPlugin);
            }
        }
    }
    return usersIdDistributionMap;
}
Also used : 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)

Example 8 with IDynamicPluginConfiguration

use of org.talend.core.runtime.dynamic.IDynamicPluginConfiguration in project tbd-studio-se by Talend.

the class DynamicDistributionManager method getBuiltinIdDynamicDistributionMap.

private Map<String, IDynamicPlugin> getBuiltinIdDynamicDistributionMap() throws Exception {
    if (builtinIdDistributionMap != null) {
        String systemCacheVersion = HadoopDistributionsHelper.getCacheVersion();
        if (StringUtils.equals(systemCacheVersion, builtinIdDistributionMapCacheVersion)) {
            return builtinIdDistributionMap;
        }
    }
    builtinIdDistributionMap = new HashMap<>();
    builtinIdDistributionMapCacheVersion = HadoopDistributionsHelper.getCacheVersion();
    IDynamicMonitor monitor = new DummyDynamicMonitor();
    List<IDynamicPlugin> allBuiltinDynamicPlugins = getAllBuiltinDynamicPlugins(monitor);
    if (allBuiltinDynamicPlugins != null && !allBuiltinDynamicPlugins.isEmpty()) {
        for (IDynamicPlugin dynamicPlugin : allBuiltinDynamicPlugins) {
            IDynamicPluginConfiguration pluginConfiguration = dynamicPlugin.getPluginConfiguration();
            if (pluginConfiguration != null) {
                String id = pluginConfiguration.getId();
                builtinIdDistributionMap.put(id, dynamicPlugin);
            }
        }
    }
    return builtinIdDistributionMap;
}
Also used : 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)

Example 9 with IDynamicPluginConfiguration

use of org.talend.core.runtime.dynamic.IDynamicPluginConfiguration in project tbd-studio-se by Talend.

the class DynamicDistributionManager method saveUsersDynamicPlugin.

public void saveUsersDynamicPlugin(IDynamicPlugin dynamicPlugin, String filePath, IDynamicMonitor monitor) throws Exception {
    FileOutputStream outStream = null;
    IDynamicPluginConfiguration pluginConfiguration = dynamicPlugin.getPluginConfiguration();
    Object obj = pluginConfiguration.getAttribute(DynamicConstants.ATTR_FILE_PATH);
    try {
        obj = pluginConfiguration.removeAttribute(DynamicConstants.ATTR_FILE_PATH);
        String content = DynamicServiceUtil.formatJsonString(dynamicPlugin.toXmlJson().toString());
        File outFile = new File(filePath);
        outStream = new FileOutputStream(outFile);
        // $NON-NLS-1$
        outStream.write(content.getBytes("UTF-8"));
        outStream.flush();
    } finally {
        pluginConfiguration.setAttribute(DynamicConstants.ATTR_FILE_PATH, obj);
        if (outStream != null) {
            try {
                outStream.close();
            } catch (Exception e) {
                ExceptionHandler.process(e);
            }
        }
    }
}
Also used : FileOutputStream(java.io.FileOutputStream) IDynamicPluginConfiguration(org.talend.core.runtime.dynamic.IDynamicPluginConfiguration) File(java.io.File)

Example 10 with IDynamicPluginConfiguration

use of org.talend.core.runtime.dynamic.IDynamicPluginConfiguration in project tbd-studio-se by Talend.

the class AbstractDynamicDistribution method unregister.

@Override
public void unregister(IDynamicPlugin dynamicPlugin, IDynamicMonitor monitor, boolean reloadLibCache) throws Exception {
    IDynamicPluginConfiguration pluginConfiguration = dynamicPlugin.getPluginConfiguration();
    String id = pluginConfiguration.getId();
    IDynamicDistributionTemplate distribution = registedDistribution.remove(id);
    if (distribution != null) {
        unloadDistribution(distribution, reloadLibCache);
    }
}
Also used : IDynamicDistributionTemplate(org.talend.hadoop.distribution.dynamic.template.IDynamicDistributionTemplate) IDynamicPluginConfiguration(org.talend.core.runtime.dynamic.IDynamicPluginConfiguration)

Aggregations

IDynamicPluginConfiguration (org.talend.core.runtime.dynamic.IDynamicPluginConfiguration)38 IDynamicPlugin (org.talend.core.runtime.dynamic.IDynamicPlugin)16 DynamicPluginAdapter (org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter)10 Set (java.util.Set)6 NodeComponentTypeBean (org.talend.hadoop.distribution.NodeComponentTypeBean)6 File (java.io.File)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)5 DummyDynamicMonitor (org.talend.designer.maven.aether.DummyDynamicMonitor)5 IDynamicMonitor (org.talend.designer.maven.aether.IDynamicMonitor)5 IDynamicDistributionTemplate (org.talend.hadoop.distribution.dynamic.template.IDynamicDistributionTemplate)4 ArrayList (java.util.ArrayList)3 Project (org.talend.core.model.general.Project)3 DynamicConfiguration (org.talend.hadoop.distribution.dynamic.DynamicConfiguration)3 DynamicDistributionSetupData (org.talend.repository.hadoopcluster.ui.dynamic.DynamicDistributionSetupData)3 IFolder (org.eclipse.core.resources.IFolder)2 IProject (org.eclipse.core.resources.IProject)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 Bundle (org.osgi.framework.Bundle)2 LoginException (org.talend.commons.exception.LoginException)2 PersistenceException (org.talend.commons.exception.PersistenceException)2