use of org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter in project tbd-studio-se by Talend.
the class DynamicHiveOnSparkModuleGroup method getModuleGroups.
@Override
public Set<DistributionModuleGroup> getModuleGroups() throws Exception {
Set<DistributionModuleGroup> hs = new HashSet<>();
DynamicPluginAdapter pluginAdapter = getPluginAdapter();
String sparkHiveRuntimeId = pluginAdapter.getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.SPARK_HIVE_MRREQUIRED_MODULE_GROUP.getModuleName());
checkRuntimeId(sparkHiveRuntimeId);
if (StringUtils.isNotBlank(sparkHiveRuntimeId)) {
DistributionModuleGroup dmg = new DistributionModuleGroup(sparkHiveRuntimeId, true);
hs.add(dmg);
}
return hs;
}
use of org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter in project tbd-studio-se by Talend.
the class DynamicMapReduceModuleGroup method getModuleGroups.
@Override
public Set<DistributionModuleGroup> getModuleGroups() throws Exception {
Set<DistributionModuleGroup> hs = new HashSet<>();
DynamicPluginAdapter pluginAdapter = getPluginAdapter();
String hdfsRuntimeId = pluginAdapter.getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.HDFS_MODULE_GROUP.getModuleName());
checkRuntimeId(hdfsRuntimeId);
String mrRuntimeId = pluginAdapter.getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.MAPREDUCE_MODULE_GROUP.getModuleName());
checkRuntimeId(mrRuntimeId);
String mrParquetId = pluginAdapter.getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.MAPREDUCE_PARQUET_MODULE_GROUP.getModuleName());
checkRuntimeId(mrParquetId);
String mrParquetRequired = pluginAdapter.getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.MAPREDUCE_PARQUET_MRREQUIRED_MODULE_GROUP.getModuleName());
checkRuntimeId(mrParquetRequired);
String mrAvroRequired = pluginAdapter.getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.MAPREDUCE_AVRO_MRREQUIRED_MODULE_GROUP.getModuleName());
checkRuntimeId(mrAvroRequired);
if (StringUtils.isNotBlank(hdfsRuntimeId)) {
hs.add(new DistributionModuleGroup(hdfsRuntimeId));
}
if (StringUtils.isNotBlank(mrRuntimeId)) {
hs.add(new DistributionModuleGroup(mrRuntimeId));
}
if (StringUtils.isNotBlank(mrParquetId)) {
hs.add(new DistributionModuleGroup(mrParquetId));
}
if (StringUtils.isNotBlank(mrParquetRequired)) {
hs.add(new DistributionModuleGroup(mrParquetRequired, true));
}
if (StringUtils.isNotBlank(mrAvroRequired)) {
hs.add(new DistributionModuleGroup(mrAvroRequired, true));
}
return hs;
}
use of org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter in project tbd-studio-se by Talend.
the class ModuleGroupDetailsForm method initData.
protected void initData() {
try {
DynamicModuleGroupData moduleGroupData = getModuleGroupData();
String groupTemplateId = moduleGroupData.getGroupTemplateId();
groupTemplateIdLabel.setText(// $NON-NLS-1$
Messages.getString("ModuleGroupDetailsForm.groupDetails.label.groupTemplateId", groupTemplateId));
DynamicPluginAdapter pluginAdapter = moduleGroupData.getPluginAdapter();
IDynamicConfiguration moduleGroup = pluginAdapter.getModuleGroupByTemplateId(groupTemplateId);
List<IDynamicConfiguration> childConfigurations = moduleGroup.getChildConfigurations();
if (childConfigurations != null) {
Collections.sort(childConfigurations, new DynamicAttributeComparator());
}
groupDetailsViewer.setInput(childConfigurations);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
use of org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter in project tbd-studio-se by Talend.
the class ModuleGroupDetailsForm method onDeleteBtnSelected.
protected void onDeleteBtnSelected() {
IStructuredSelection selection = (IStructuredSelection) groupDetailsViewer.getSelection();
IDynamicConfiguration firstElement = (IDynamicConfiguration) selection.getFirstElement();
DynamicModuleGroupData moduleGroupData = getModuleGroupData();
String groupTemplateId = moduleGroupData.getGroupTemplateId();
DynamicPluginAdapter pluginAdapter = moduleGroupData.getPluginAdapter();
IDynamicConfiguration moduleGroup = pluginAdapter.getModuleGroupByTemplateId(groupTemplateId);
List<IDynamicConfiguration> childConfigurations = moduleGroup.getChildConfigurations();
childConfigurations.remove(firstElement);
groupDetailsViewer.refresh();
}
use of org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter in project tbd-studio-se by Talend.
the class AbstractDynamicDistributionSetupForm method saveDynamicDistribution.
protected void saveDynamicDistribution(IDynamicPlugin dynamicPlugin, IDynamicDistributionsGroup dynDistrGroup, ActionType actionType, IDynamicMonitor dMonitor) throws Exception {
IDynamicPluginConfiguration pluginConfiguration = dynamicPlugin.getPluginConfiguration();
dMonitor.beginTask(// $NON-NLS-1$
Messages.getString("AbstractDynamicDistributionSetupForm.progress.saving", pluginConfiguration.getName()), IDynamicMonitor.UNKNOWN);
// step 1: clean unused modules
IDynamicDistributionPreference dynamicDistributionPreference = dynDistrGroup.getDynamicDistributionPreference(ProjectManager.getInstance().getCurrentProject());
DynamicPluginAdapter pluginAdapter = new DynamicPluginAdapter(dynamicPlugin, dynamicDistributionPreference, null);
pluginAdapter.cleanUnusedAndRefresh();
// step 2: save
final IDynamicPlugin fDynPlugin = pluginAdapter.getPlugin();
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(new RepositoryWorkUnit<Boolean>(Messages.getString("AbstractDynamicDistributionSetupForm.repositoryWorkUnit.title", // $NON-NLS-1$
pluginConfiguration.getName())) {
@Override
protected void run() throws LoginException, PersistenceException {
result = false;
try {
DynamicDistributionManager.getInstance().saveUsersDynamicPlugin(fDynPlugin, dMonitor);
} catch (Exception e) {
throw new PersistenceException(e);
}
result = true;
}
});
// step 3: regist
dMonitor.setTaskName(// $NON-NLS-1$
Messages.getString("AbstractDynamicDistributionSetupForm.progress.registing", pluginConfiguration.getName()));
if (ActionType.EditExisting.equals(actionType)) {
dynDistrGroup.unregister(fDynPlugin, dMonitor, false);
}
dynDistrGroup.register(fDynPlugin, dMonitor);
// step 4: reset system cache
// $NON-NLS-1$
dMonitor.setTaskName(Messages.getString("AbstractDynamicDistributionSetupForm.progress.resetCache"));
DynamicDistributionManager.getInstance().resetSystemCache();
}
Aggregations