use of org.talend.core.runtime.dynamic.IDynamicPlugin in project tbd-studio-se by Talend.
the class AbstractDynamicDistributionTemplate method registPluginExtensions.
@Override
public boolean registPluginExtensions() {
if (registedPluginAdapter == null) {
synchronized (registedPluginAdapterLock) {
if (registedPluginAdapter == null) {
DynamicPluginAdapter plugAdapter = getPluginAdapter();
IDynamicPlugin plugin = plugAdapter.getPlugin();
IDynamicPluginConfiguration pConfiguration = plugin.getPluginConfiguration();
try {
plugin.setPluginConfiguration(null);
DynamicServiceUtil.addContribution(plugAdapter.getBundle(), plugin);
registedPluginAdapter = plugAdapter;
ILibrariesService libService = ILibrariesService.get();
if (libService != null) {
libService.resetModulesNeeded();
}
HadoopDistributionsHelper.updatePluginExtensionCacheVersion();
return true;
} catch (Exception e) {
ExceptionHandler.process(e);
} finally {
plugin.setPluginConfiguration(pConfiguration);
}
}
}
}
return false;
}
use of org.talend.core.runtime.dynamic.IDynamicPlugin 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;
}
use of org.talend.core.runtime.dynamic.IDynamicPlugin in project tbd-studio-se by Talend.
the class DynamicDistributionManager method getAllUsersDynamicPlugins.
public List<IDynamicPlugin> getAllUsersDynamicPlugins(IDynamicMonitor monitor) throws Exception {
if (usersPluginsCache != null) {
String systemCacheVersion = HadoopDistributionsHelper.getCacheVersion();
if (StringUtils.equals(systemCacheVersion, usersPluginsCacheVersion)) {
return usersPluginsCache;
}
}
usersPluginsCacheVersion = HadoopDistributionsHelper.getCacheVersion();
List<IDynamicPlugin> dynamicPlugins = new LinkedList<>();
List<IDynamicPlugin> tempDynPlugins = null;
ProjectManager projectManager = ProjectManager.getInstance();
List<Project> allRefProjects = ProjectManager.getInstance().getAllReferencedProjects();
if (allRefProjects != null && 0 < allRefProjects.size()) {
for (Project refProject : allRefProjects) {
try {
tempDynPlugins = getAllUsersDynamicPluginsForProject(refProject, monitor);
if (tempDynPlugins != null && 0 < tempDynPlugins.size()) {
dynamicPlugins.addAll(tempDynPlugins);
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}
/**
* MUST put dynamic plugins of current project AT THE END OF THE LIST!!!<br>
* so that they can overwrite the same id dynamic plugins from reference projects
*/
tempDynPlugins = getAllUsersDynamicPluginsForProject(projectManager.getCurrentProject(), monitor);
if (tempDynPlugins != null && 0 < tempDynPlugins.size()) {
dynamicPlugins.addAll(tempDynPlugins);
}
usersPluginsCache = dynamicPlugins;
return usersPluginsCache;
}
use of org.talend.core.runtime.dynamic.IDynamicPlugin 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;
}
use of org.talend.core.runtime.dynamic.IDynamicPlugin in project tbd-studio-se by Talend.
the class DynamicDistributionOptionForm method refreshExistingConfigsCombo.
private void refreshExistingConfigsCombo(IDynamicMonitor monitor, IDynamicDistributionsGroup dynamicDistributionsGroup) throws Exception {
List<IDynamicPlugin> distriDynamicPlugins = copyAllUsersDynamicPlugins(monitor, dynamicDistributionsGroup);
existingConfigsComboViewer.setInput(distriDynamicPlugins);
if (0 < distriDynamicPlugins.size()) {
existingConfigsComboViewer.setSelection(new StructuredSelection(distriDynamicPlugins.get(0)));
}
}
Aggregations