Search in sources :

Example 61 with DynamicPluginAdapter

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;
}
Also used : DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) DistributionModuleGroup(org.talend.hadoop.distribution.DistributionModuleGroup) HashSet(java.util.HashSet)

Example 62 with DynamicPluginAdapter

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;
}
Also used : DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) DistributionModuleGroup(org.talend.hadoop.distribution.DistributionModuleGroup) HashSet(java.util.HashSet)

Example 63 with DynamicPluginAdapter

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);
    }
}
Also used : IDynamicConfiguration(org.talend.core.runtime.dynamic.IDynamicConfiguration) DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) DynamicModuleGroupData(org.talend.repository.hadoopcluster.ui.dynamic.DynamicModuleGroupData) DynamicAttributeComparator(org.talend.hadoop.distribution.dynamic.comparator.DynamicAttributeComparator)

Example 64 with DynamicPluginAdapter

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();
}
Also used : IDynamicConfiguration(org.talend.core.runtime.dynamic.IDynamicConfiguration) DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DynamicModuleGroupData(org.talend.repository.hadoopcluster.ui.dynamic.DynamicModuleGroupData)

Example 65 with DynamicPluginAdapter

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();
}
Also used : IDynamicDistributionPreference(org.talend.hadoop.distribution.dynamic.pref.IDynamicDistributionPreference) DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) IDynamicPlugin(org.talend.core.runtime.dynamic.IDynamicPlugin) PersistenceException(org.talend.commons.exception.PersistenceException) LoginException(org.talend.commons.exception.LoginException) IDynamicPluginConfiguration(org.talend.core.runtime.dynamic.IDynamicPluginConfiguration) LoginException(org.talend.commons.exception.LoginException) PersistenceException(org.talend.commons.exception.PersistenceException)

Aggregations

DynamicPluginAdapter (org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter)65 HashSet (java.util.HashSet)43 DistributionModuleGroup (org.talend.hadoop.distribution.DistributionModuleGroup)43 IDynamicPluginConfiguration (org.talend.core.runtime.dynamic.IDynamicPluginConfiguration)10 SparkStreamingLinkedNodeCondition (org.talend.hadoop.distribution.condition.common.SparkStreamingLinkedNodeCondition)10 MultiComponentCondition (org.talend.hadoop.distribution.condition.MultiComponentCondition)8 Set (java.util.Set)6 NodeComponentTypeBean (org.talend.hadoop.distribution.NodeComponentTypeBean)6 ComponentCondition (org.talend.hadoop.distribution.condition.ComponentCondition)6 SimpleComponentCondition (org.talend.hadoop.distribution.condition.SimpleComponentCondition)6 BasicExpression (org.talend.hadoop.distribution.condition.BasicExpression)5 SparkBatchLinkedNodeCondition (org.talend.hadoop.distribution.condition.common.SparkBatchLinkedNodeCondition)5 IDynamicConfiguration (org.talend.core.runtime.dynamic.IDynamicConfiguration)4 IDynamicPlugin (org.talend.core.runtime.dynamic.IDynamicPlugin)4 ComponentType (org.talend.hadoop.distribution.ComponentType)4 HiveOnSparkComponent (org.talend.hadoop.distribution.component.HiveOnSparkComponent)4 SparkBatchComponent (org.talend.hadoop.distribution.component.SparkBatchComponent)4 SparkStreamingComponent (org.talend.hadoop.distribution.component.SparkStreamingComponent)4 SqoopComponent (org.talend.hadoop.distribution.component.SqoopComponent)4 NestedComponentCondition (org.talend.hadoop.distribution.condition.NestedComponentCondition)4