use of org.talend.hadoop.distribution.ComponentType in project tbd-studio-se by Talend.
the class AbstractDynamicCDPDistributionTemplate method buildModuleGroupsTemplateMap.
@Override
protected Map<ComponentType, IDynamicModuleGroupTemplate> buildModuleGroupsTemplateMap() {
Map<ComponentType, IDynamicModuleGroupTemplate> groupTemplateMap = super.buildModuleGroupsTemplateMap();
DynamicPluginAdapter pluginAdapter = getPluginAdapter();
if (this instanceof HiveOnSparkComponent) {
groupTemplateMap.put(ComponentType.HIVEONSPARK, new DynamicCDPHiveOnSparkModuleGroupTemplate(pluginAdapter));
}
if (this instanceof SparkBatchComponent) {
groupTemplateMap.put(ComponentType.SPARKBATCH, new DynamicCDPSparkBatchModuleGroupTemplate(pluginAdapter));
}
if (this instanceof SparkStreamingComponent) {
groupTemplateMap.put(ComponentType.SPARKSTREAMING, new DynamicCDPSparkStreamingModuleGroupTemplate(pluginAdapter));
}
if (this instanceof SqoopComponent) {
groupTemplateMap.put(ComponentType.SQOOP, new DynamicCDPSqoopModuleGroupTemplate(pluginAdapter));
}
if (this instanceof ImpalaComponent) {
groupTemplateMap.put(ComponentType.IMPALA, new DynamicImpalaModuleGroupTemplate(pluginAdapter));
}
return groupTemplateMap;
}
use of org.talend.hadoop.distribution.ComponentType in project tbd-studio-se by Talend.
the class AbstractDynamicDistributionTemplate method buildModuleGroupsMap.
protected Map<ComponentType, Set<DistributionModuleGroup>> buildModuleGroupsMap(DynamicPluginAdapter pluginAdapter) throws Exception {
Map<ComponentType, Set<DistributionModuleGroup>> moduleGroupsMap = new HashMap<>();
for (Map.Entry<ComponentType, IDynamicModuleGroupTemplate> entry : moduleGroupsTemplateMap.entrySet()) {
Map<ComponentType, Set<DistributionModuleGroup>> groupMap = entry.getValue().getModuleGroups();
if (groupMap != null && !groupMap.isEmpty()) {
for (Map.Entry<ComponentType, Set<DistributionModuleGroup>> groupEntry : groupMap.entrySet()) {
ComponentType key = groupEntry.getKey();
Set<DistributionModuleGroup> existingGroupSet = moduleGroupsMap.get(key);
if (existingGroupSet != null) {
String name = "";
try {
name = key.name();
} catch (Exception e) {
ExceptionHandler.process(e);
} finally {
CommonExceptionHandler.warn(this.getClass().getSimpleName() + " : multiple define of " + name + ", will merge it.");
}
existingGroupSet.addAll(groupEntry.getValue());
} else {
moduleGroupsMap.put(key, groupEntry.getValue());
}
}
}
}
return moduleGroupsMap;
}
use of org.talend.hadoop.distribution.ComponentType in project tbd-studio-se by Talend.
the class AbstractDynamicHDPDistributionTemplate method buildModuleGroupsTemplateMap.
@Override
protected Map<ComponentType, IDynamicModuleGroupTemplate> buildModuleGroupsTemplateMap() {
Map<ComponentType, IDynamicModuleGroupTemplate> groupTemplateMap = super.buildModuleGroupsTemplateMap();
DynamicPluginAdapter pluginAdapter = getPluginAdapter();
if (this instanceof HDFSComponent) {
groupTemplateMap.put(ComponentType.HDFS, new DynamicHDPHDFSModuleGroupTemplate(pluginAdapter));
}
if (this instanceof MRComponent) {
groupTemplateMap.put(ComponentType.MAPREDUCE, new DynamicHDPMapReduceModuleGroupTemplate(pluginAdapter));
}
if (this instanceof SparkBatchComponent) {
groupTemplateMap.put(ComponentType.SPARKBATCH, new DynamicHDPSparkBatchModuleGroupTemplate(pluginAdapter));
}
if (this instanceof SparkStreamingComponent) {
groupTemplateMap.put(ComponentType.SPARKSTREAMING, new DynamicHDPSparkStreamingModuleGroupTemplate(pluginAdapter));
}
if (this instanceof HiveOnSparkComponent) {
groupTemplateMap.put(ComponentType.HIVEONSPARK, new DynamicHDPHiveOnSparkModuleGroupTemplate(pluginAdapter));
}
if (this instanceof SqoopComponent) {
groupTemplateMap.put(ComponentType.SQOOP, new DynamicHDPSqoopModuleGroupTemplate(pluginAdapter));
}
return groupTemplateMap;
}
use of org.talend.hadoop.distribution.ComponentType in project tbd-studio-se by Talend.
the class HadoopClusterPropertyTypeParameterRelationshipHandler method collect.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.relationship.AbstractParameterRelationshipHandler#collect(java.util.Map,
* java.util.Map)
*/
@Override
protected Set<Relation> collect(Map<String, ElementParameterType> parametersMap, Map<?, ?> options) {
if (parametersMap == null || parametersMap.isEmpty()) {
return Collections.emptySet();
}
Set<Relation> relationSet = new HashSet<Relation>();
ElementParameterType repositoryTypeParam = parametersMap.get(PropertyTypeParameterRelationshipHandler.PROPERTY_PROPERTY_TYPE);
if (repositoryTypeParam != null && AbstractJobParameterInRepositoryRelationshipHandler.IN_REPOSITORY.equals(repositoryTypeParam.getValue())) {
ElementParameterType repositoryTypeValueParam = parametersMap.get(PropertyTypeParameterRelationshipHandler.PROPERTY_REPOSITORY_PROPERTY_TYPE);
if (repositoryTypeValueParam != null) {
String repositoryIdOrValue = repositoryTypeValueParam.getValue();
if (StringUtils.isNotEmpty(repositoryIdOrValue)) {
Item hadoopClusterItem = HCRepositoryUtil.getHadoopClusterItemBySubitemId(repositoryIdOrValue);
if (hadoopClusterItem != null) {
String hcId = hadoopClusterItem.getProperty().getId();
Relation addedRelation = new Relation();
addedRelation.setId(hcId);
addedRelation.setType(RelationshipItemBuilder.PROPERTY_RELATION);
addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
relationSet.add(addedRelation);
}
}
}
}
for (ElementParameterType eleParamType : parametersMap.values()) {
if (EParameterFieldType.HADOOP_DISTRIBUTION.name().equals(eleParamType.getField())) {
String name = eleParamType.getName();
if (StringUtils.isNotEmpty(name)) {
ComponentType componentType = ComponentType.getComponentType(name);
if (componentType != null) {
String versionParam = componentType.getVersionParameter();
if (StringUtils.isNotEmpty(versionParam)) {
ElementParameterType elemParam = parametersMap.get(versionParam);
if (elemParam != null) {
String value = elemParam.getValue();
if (StringUtils.isNotEmpty(value)) {
if (DynamicDistributionManager.getInstance().isUsersDynamicDistribution(value)) {
Relation addedRelation = new Relation();
addedRelation.setId(value);
addedRelation.setType(RelationshipItemBuilder.DYNAMIC_DISTRIBUTION_RELATION);
addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
relationSet.add(addedRelation);
}
}
}
}
}
}
break;
}
}
return relationSet;
}
Aggregations