Search in sources :

Example 6 with ComponentType

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;
}
Also used : ImpalaComponent(org.talend.hadoop.distribution.component.ImpalaComponent) ComponentType(org.talend.hadoop.distribution.ComponentType) DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) HiveOnSparkComponent(org.talend.hadoop.distribution.component.HiveOnSparkComponent) DynamicImpalaModuleGroupTemplate(org.talend.hadoop.distribution.dynamic.template.DynamicImpalaModuleGroupTemplate) SparkBatchComponent(org.talend.hadoop.distribution.component.SparkBatchComponent) IDynamicModuleGroupTemplate(org.talend.hadoop.distribution.dynamic.template.IDynamicModuleGroupTemplate) SparkStreamingComponent(org.talend.hadoop.distribution.component.SparkStreamingComponent) SqoopComponent(org.talend.hadoop.distribution.component.SqoopComponent)

Example 7 with ComponentType

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;
}
Also used : ComponentType(org.talend.hadoop.distribution.ComponentType) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) DistributionModuleGroup(org.talend.hadoop.distribution.DistributionModuleGroup)

Example 8 with ComponentType

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;
}
Also used : ComponentType(org.talend.hadoop.distribution.ComponentType) DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) HiveOnSparkComponent(org.talend.hadoop.distribution.component.HiveOnSparkComponent) MRComponent(org.talend.hadoop.distribution.component.MRComponent) SparkBatchComponent(org.talend.hadoop.distribution.component.SparkBatchComponent) HDFSComponent(org.talend.hadoop.distribution.component.HDFSComponent) IDynamicModuleGroupTemplate(org.talend.hadoop.distribution.dynamic.template.IDynamicModuleGroupTemplate) SparkStreamingComponent(org.talend.hadoop.distribution.component.SparkStreamingComponent) SqoopComponent(org.talend.hadoop.distribution.component.SqoopComponent)

Example 9 with ComponentType

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;
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) Item(org.talend.core.model.properties.Item) Relation(org.talend.core.model.relationship.Relation) ComponentType(org.talend.hadoop.distribution.ComponentType) HashSet(java.util.HashSet)

Aggregations

ComponentType (org.talend.hadoop.distribution.ComponentType)9 HashMap (java.util.HashMap)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 DynamicPluginAdapter (org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter)4 HashSet (java.util.HashSet)3 ImpalaComponent (org.talend.hadoop.distribution.component.ImpalaComponent)3 MRComponent (org.talend.hadoop.distribution.component.MRComponent)3 IDynamicModuleGroupTemplate (org.talend.hadoop.distribution.dynamic.template.IDynamicModuleGroupTemplate)3 Map (java.util.Map)2 Set (java.util.Set)2 DistributionModuleGroup (org.talend.hadoop.distribution.DistributionModuleGroup)2 HDFSComponent (org.talend.hadoop.distribution.component.HDFSComponent)2 DynamicImpalaModuleGroupTemplate (org.talend.hadoop.distribution.dynamic.template.DynamicImpalaModuleGroupTemplate)2 LinkedList (java.util.LinkedList)1 BundleContext (org.osgi.framework.BundleContext)1 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)1 ServiceReference (org.osgi.framework.ServiceReference)1