use of org.talend.hadoop.distribution.ESparkVersion 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.ESparkVersion in project tbd-studio-se by Talend.
the class AbstractDynamicDistributionTemplate method getSparkVersions.
@Override
public Set<ESparkVersion> getSparkVersions() {
Set<ESparkVersion> version = new HashSet<>();
IDynamicPluginConfiguration pluginConfiguration = pluginAdapter.getPluginConfiguration();
List<String> selectedSparkVersions = (List<String>) pluginConfiguration.getAttribute(DynamicConstants.ATTR_SELECTED_SPARK_VERSIONS);
if (selectedSparkVersions != null) {
List<ESparkVersion> sparkVersions = DynamicDistributionUtils.convert2ESparkVersions(selectedSparkVersions);
version.addAll(sparkVersions);
}
return version;
}
use of org.talend.hadoop.distribution.ESparkVersion in project tbd-studio-se by Talend.
the class DynamicDistributionOptionForm method refreshSparkVersionCombo.
private void refreshSparkVersionCombo(String version) throws Exception {
selectedSparkVersions.clear();
TemplateBean compatibleTemplate = getDynamicDistributionSetupData().getDynamicDistributionsGroup().getCompatibleDistribution(null, version).getCompatibleTemplate(null, version);
List<String> supportedSparkVersions = compatibleTemplate.getSupportedSparkVersions();
if (supportedSparkVersions != null && !supportedSparkVersions.isEmpty()) {
List<ESparkVersion> versions = DynamicDistributionUtils.convert2ESparkVersions(supportedSparkVersions);
sparkVersionsComboViewer.getSelection();
sparkVersionsComboViewer.setInput(versions);
if (!versions.isEmpty()) {
ESparkVersion defaultSparkVersion = versions.get(0);
sparkVersionsComboViewer.setSelection(new StructuredSelection(defaultSparkVersion));
}
}
}
Aggregations