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