Search in sources :

Example 16 with ComponentCondition

use of org.talend.hadoop.distribution.condition.ComponentCondition in project tbd-studio-se by Talend.

the class ModuleGroupsUtils method getStreamingModuleGroups.

/**
 * Utility method to create the collection of {@link DistributionModuleGroup} with a condition made of a
 * {@link SparkStreamingLinkedNodeCondition} and an additional raw condition
 *
 * @param distribution the distribution key
 * @param version the version key
 * @param condition a nullable additional condition
 * @param moduleName the module name
 * @param mrRequired if the module group is mrRequired
 * @return a set of {@link DistributionModuleGroup}
 */
public static Set<DistributionModuleGroup> getStreamingModuleGroups(String distribution, String version, ComponentCondition condition, String moduleName, boolean mrRequired) {
    Set<DistributionModuleGroup> hs = new HashSet<>();
    ComponentCondition distribCondition = new SparkStreamingLinkedNodeCondition(distribution, version).getCondition();
    ComponentCondition cc = null;
    if (condition != null) {
        cc = new MultiComponentCondition(condition, BooleanOperator.AND, distribCondition);
    } else {
        cc = distribCondition;
    }
    DistributionModuleGroup dmg = new DistributionModuleGroup(moduleName, mrRequired, cc);
    hs.add(dmg);
    return hs;
}
Also used : SparkStreamingLinkedNodeCondition(org.talend.hadoop.distribution.condition.common.SparkStreamingLinkedNodeCondition) MultiComponentCondition(org.talend.hadoop.distribution.condition.MultiComponentCondition) SimpleComponentCondition(org.talend.hadoop.distribution.condition.SimpleComponentCondition) ComponentCondition(org.talend.hadoop.distribution.condition.ComponentCondition) MultiComponentCondition(org.talend.hadoop.distribution.condition.MultiComponentCondition) DistributionModuleGroup(org.talend.hadoop.distribution.DistributionModuleGroup) HashSet(java.util.HashSet)

Example 17 with ComponentCondition

use of org.talend.hadoop.distribution.condition.ComponentCondition in project tbd-studio-se by Talend.

the class DynamicSqoopModuleGroup method getModuleGroups.

@Override
public Set<DistributionModuleGroup> getModuleGroups() throws Exception {
    Set<DistributionModuleGroup> hs = new HashSet<>();
    DynamicPluginAdapter pluginAdapter = getPluginAdapter();
    String sqoopRuntimeId = pluginAdapter.getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.SQOOP_MODULE_GROUP.getModuleName());
    String sqoopParquetRuntimeId = pluginAdapter.getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.SQOOP_PARQUET_MODULE_GROUP.getModuleName());
    String sqoopHiveRuntimeId = pluginAdapter.getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.SQOOP_HIVE_MODULE_GROUP.getModuleName());
    checkRuntimeId(sqoopRuntimeId);
    checkRuntimeId(sqoopParquetRuntimeId);
    checkRuntimeId(sqoopHiveRuntimeId);
    if (StringUtils.isNotBlank(sqoopRuntimeId)) {
        hs.add(new DistributionModuleGroup(sqoopRuntimeId));
    }
    if (StringUtils.isNotBlank(sqoopParquetRuntimeId)) {
        ComponentCondition parquetOutputCondition = new SimpleComponentCondition(new BasicExpression(SqoopConstant.FILE_FORMAT, EqualityOperator.EQ, SqoopConstant.PAQUET_OUTPUT_FORMAT));
        hs.add(new DistributionModuleGroup(sqoopParquetRuntimeId, true, parquetOutputCondition));
    }
    if (StringUtils.isNotBlank(sqoopHiveRuntimeId)) {
        ComponentCondition hiveOutputCondition = new SimpleComponentCondition(new RawExpression("ADDITIONAL_JAVA CONTAINS {ADDITIONAL_ARGUMENT=\"hive.import\", ADDITIONAL_VALUE=\"true\"}"));
        hs.add(new DistributionModuleGroup(sqoopHiveRuntimeId, true, hiveOutputCondition));
    }
    return hs;
}
Also used : DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) BasicExpression(org.talend.hadoop.distribution.condition.BasicExpression) RawExpression(org.talend.hadoop.distribution.condition.RawExpression) SimpleComponentCondition(org.talend.hadoop.distribution.condition.SimpleComponentCondition) SimpleComponentCondition(org.talend.hadoop.distribution.condition.SimpleComponentCondition) ComponentCondition(org.talend.hadoop.distribution.condition.ComponentCondition) DistributionModuleGroup(org.talend.hadoop.distribution.DistributionModuleGroup) HashSet(java.util.HashSet)

Example 18 with ComponentCondition

use of org.talend.hadoop.distribution.condition.ComponentCondition in project tbd-studio-se by Talend.

the class DynamicCDHMapReduceModuleGroup method getModuleGroups.

@Override
public Set<DistributionModuleGroup> getModuleGroups() throws Exception {
    Set<DistributionModuleGroup> moduleGroups = new HashSet<>();
    Set<DistributionModuleGroup> moduleGroupsFromSuper = super.getModuleGroups();
    if (moduleGroupsFromSuper != null && !moduleGroupsFromSuper.isEmpty()) {
        moduleGroups.addAll(moduleGroupsFromSuper);
    }
    ComponentCondition conditionUseNavigator = new SimpleComponentCondition(new BasicExpression(MRConstant.USE_CLOUDERA_NAVIGATOR));
    String talendClouderaNaviRuntimeId = getPluginAdapter().getRuntimeModuleGroupIdByTemplateId(DynamicCDHModuleGroupConstant.TALEND_CLOUDERA_CDH_NAVIGATOR.getModuleName());
    checkRuntimeId(talendClouderaNaviRuntimeId);
    if (StringUtils.isNotBlank(talendClouderaNaviRuntimeId)) {
        moduleGroups.add(new DistributionModuleGroup(talendClouderaNaviRuntimeId, true, conditionUseNavigator));
    }
    return moduleGroups;
}
Also used : BasicExpression(org.talend.hadoop.distribution.condition.BasicExpression) SimpleComponentCondition(org.talend.hadoop.distribution.condition.SimpleComponentCondition) SimpleComponentCondition(org.talend.hadoop.distribution.condition.SimpleComponentCondition) ComponentCondition(org.talend.hadoop.distribution.condition.ComponentCondition) DistributionModuleGroup(org.talend.hadoop.distribution.DistributionModuleGroup) HashSet(java.util.HashSet)

Example 19 with ComponentCondition

use of org.talend.hadoop.distribution.condition.ComponentCondition in project tbd-studio-se by Talend.

the class EMR5290SqoopModuleGroup method getModuleGroups.

public static Set<DistributionModuleGroup> getModuleGroups() {
    Set<DistributionModuleGroup> hs = new HashSet<>();
    hs.add(new DistributionModuleGroup(EMR5290Constant.SQOOP_MODULE_GROUP.getModuleName()));
    hs.add(new DistributionModuleGroup(EMR5290Constant.MAPREDUCE_MODULE_GROUP.getModuleName()));
    hs.add(new DistributionModuleGroup(EMR5290Constant.HDFS_MODULE_GROUP.getModuleName()));
    ComponentCondition parquetOutputCondition = new SimpleComponentCondition(new BasicExpression(SqoopConstant.FILE_FORMAT, EqualityOperator.EQ, SqoopConstant.PAQUET_OUTPUT_FORMAT));
    hs.add(new DistributionModuleGroup(EMR5290Constant.SQOOP_PARQUET_MODULE_GROUP.getModuleName(), true, parquetOutputCondition));
    return hs;
}
Also used : BasicExpression(org.talend.hadoop.distribution.condition.BasicExpression) SimpleComponentCondition(org.talend.hadoop.distribution.condition.SimpleComponentCondition) SimpleComponentCondition(org.talend.hadoop.distribution.condition.SimpleComponentCondition) ComponentCondition(org.talend.hadoop.distribution.condition.ComponentCondition) DistributionModuleGroup(org.talend.hadoop.distribution.DistributionModuleGroup) HashSet(java.util.HashSet)

Aggregations

ComponentCondition (org.talend.hadoop.distribution.condition.ComponentCondition)19 SimpleComponentCondition (org.talend.hadoop.distribution.condition.SimpleComponentCondition)19 BasicExpression (org.talend.hadoop.distribution.condition.BasicExpression)15 HashSet (java.util.HashSet)14 MultiComponentCondition (org.talend.hadoop.distribution.condition.MultiComponentCondition)14 DistributionModuleGroup (org.talend.hadoop.distribution.DistributionModuleGroup)12 DynamicPluginAdapter (org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter)6 NestedComponentCondition (org.talend.hadoop.distribution.condition.NestedComponentCondition)5 ShowExpression (org.talend.hadoop.distribution.condition.ShowExpression)4 Set (java.util.Set)3 Expression (org.talend.hadoop.distribution.condition.Expression)3 RawExpression (org.talend.hadoop.distribution.condition.RawExpression)3 HashMap (java.util.HashMap)2 SparkBatchLinkedNodeCondition (org.talend.hadoop.distribution.condition.common.SparkBatchLinkedNodeCondition)2 SparkStreamingLinkedNodeCondition (org.talend.hadoop.distribution.condition.common.SparkStreamingLinkedNodeCondition)2 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 Test (org.junit.Test)1 ComponentType (org.talend.hadoop.distribution.ComponentType)1 ESparkVersion (org.talend.hadoop.distribution.ESparkVersion)1