use of org.talend.hadoop.distribution.condition.BasicExpression in project tbd-studio-se by Talend.
the class AbstractDistribution method buildModuleGroups.
protected Map<ComponentType, Set<DistributionModuleGroup>> buildModuleGroups() {
Map<ComponentType, Set<DistributionModuleGroup>> result = new HashMap<>();
// HCatalog
result.put(ComponentType.HCATALOG, ModuleGroupsUtils.getModuleGroups(null, ModuleGroupName.HDFS.get(this.getVersion()), false));
// HDFS
result.put(ComponentType.HDFS, ModuleGroupsUtils.getModuleGroups(null, ModuleGroupName.HDFS.get(this.getVersion()), false));
// Hbase
result.put(ComponentType.HBASE, ModuleGroupsUtils.getModuleGroups(null, ModuleGroupName.HBASE.get(this.getVersion()), true));
// Hive
ComponentCondition hiveOnHbaseCondition = new MultiComponentCondition(new SimpleComponentCondition(new BasicExpression(//
HiveConstant.HIVE_CONFIGURATION_COMPONENT_HBASEPARAMETER)), //
BooleanOperator.AND, new SimpleComponentCondition(new ShowExpression(HiveConstant.HIVE_CONFIGURATION_COMPONENT_HBASEPARAMETER)));
Set<DistributionModuleGroup> hiveModuleGroups = new HashSet<>();
hiveModuleGroups.addAll(ModuleGroupsUtils.getModuleGroups(null, ModuleGroupName.HIVE.get(this.getVersion()), false));
hiveModuleGroups.addAll(ModuleGroupsUtils.getModuleGroups(hiveOnHbaseCondition, ModuleGroupName.HBASE.get(this.getVersion()), false));
result.put(ComponentType.HIVE, hiveModuleGroups);
// Hive on Spark
result.put(ComponentType.HIVEONSPARK, ModuleGroupsUtils.getModuleGroups((ComponentCondition) null, ModuleGroupName.HIVE.get(this.getVersion()), true));
// Sqoop
result.put(ComponentType.SQOOP, SqoopModuleGroup.getModuleGroups(this.getVersion()));
result.put(ComponentType.SPARKBATCH, ModuleGroupsUtils.getModuleGroups(null, ModuleGroupName.SPARK_BATCH.get(this.getVersion()), true));
result.put(ComponentType.SPARKSTREAMING, ModuleGroupsUtils.getModuleGroups(null, ModuleGroupName.SPARK_STREAMING.get(this.getVersion()), true));
return result;
}
use of org.talend.hadoop.distribution.condition.BasicExpression in project tbd-studio-se by Talend.
the class DistributionVersionModule method getModuleRequiredIf.
public ComponentCondition getModuleRequiredIf() {
ComponentCondition condition;
// The import is needed only if the good version and the good distribution are selected, and
// if the Distribution is shown. The second condition to take the
// USE_EXISTING_CONNECTIOn into account.
final ComponentType componentType = distributionVersion.distribution.componentType;
Expression distributionSelected = new BasicExpression(componentType.getDistributionParameter(), EqualityOperator.EQ, distributionVersion.distribution.name);
Expression distributionVersionSelected = new BasicExpression(componentType.getVersionParameter(), EqualityOperator.EQ, distributionVersion.version);
Expression distributionShown = new ShowExpression(componentType.getDistributionParameter());
condition = new MultiComponentCondition(new SimpleComponentCondition(distributionSelected), BooleanOperator.AND, new MultiComponentCondition(new SimpleComponentCondition(distributionVersionSelected), BooleanOperator.AND, new SimpleComponentCondition(distributionShown)));
if (moduleGroup.getRequiredIf() != null) {
condition = new MultiComponentCondition(condition, BooleanOperator.AND, new NestedComponentCondition(moduleGroup.getRequiredIf()));
}
return condition;
}
use of org.talend.hadoop.distribution.condition.BasicExpression in project tbd-studio-se by Talend.
the class ComponentConditionUtil method generateSparkVersionShowIfConditions.
/**
* Generates the "SHOW_IF" condition for the "SUPPORTED_SPARK_VERSION" drop down list. Given a map of Spark versions
* and corresponding supported hadoop versions, it builds a {@link ComponentCondition} for each entry in the map.
*
* @param supportedSparkVersions the map of Spark versions
* @return an array of a String reprensation of a {@link ComponentCondition}
*/
public static String[] generateSparkVersionShowIfConditions(Map<ESparkVersion, Set<DistributionVersion>> supportedSparkVersions) {
String[] results = null;
if (supportedSparkVersions != null) {
results = new String[supportedSparkVersions.size()];
int conditionIndex = 0;
for (Map.Entry<ESparkVersion, Set<DistributionVersion>> entry : supportedSparkVersions.entrySet()) {
Set<ComponentCondition> multiComponentConditions = new LinkedHashSet<>();
for (DistributionVersion distributionVersion : entry.getValue()) {
SimpleComponentCondition distribution = new SimpleComponentCondition(new BasicExpression("DISTRIBUTION", EqualityOperator.EQ, // $NON-NLS-1$
distributionVersion.distribution.getName()));
SimpleComponentCondition version = new SimpleComponentCondition(new BasicExpression("SPARK_VERSION", EqualityOperator.EQ, // $NON-NLS-1$
distributionVersion.getVersion()));
multiComponentConditions.add(new MultiComponentCondition(distribution, BooleanOperator.AND, version));
}
ComponentCondition componentCondition = buildDistributionShowIf(multiComponentConditions);
results[conditionIndex++] = componentCondition != null ? componentCondition.getConditionString() : null;
}
}
return results;
}
use of org.talend.hadoop.distribution.condition.BasicExpression in project tbd-studio-se by Talend.
the class DynamicSparkStreamingModuleGroup method init.
protected void init() {
// $NON-NLS-1$
spark1Condition = new SimpleComponentCondition(new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_1_6.getSparkVersion()));
spark2Condition = new MultiComponentCondition(// $NON-NLS-1$
new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_2_0.getSparkVersion()), BooleanOperator.OR, new MultiComponentCondition(// $NON-NLS-1$
new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_2_1.getSparkVersion()), BooleanOperator.OR, new MultiComponentCondition(// $NON-NLS-1$
new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_2_2.getSparkVersion()), BooleanOperator.OR, new MultiComponentCondition(// $NON-NLS-1$
new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_2_3_X.getSparkVersion()), BooleanOperator.OR, // $NON-NLS-1$
new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_2_4_X.getSparkVersion())))));
}
use of org.talend.hadoop.distribution.condition.BasicExpression in project tbd-studio-se by Talend.
the class DynamicHDPSparkBatchModuleGroup method initConditions.
@Override
protected void initConditions() {
super.initConditions();
conditionNotSpark16 = new SimpleComponentCondition(// $NON-NLS-1$
new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.NOT_EQ, ESparkVersion.SPARK_1_6.getSparkVersion()));
}
Aggregations