Search in sources :

Example 1 with ComponentType

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

the class DistributionsManager method getDistributionsDelegate.

Map<String, DistributionBean> getDistributionsDelegate() {
    if (getServiceName() == null) {
        return new HashMap<String, DistributionBean>();
    }
    final ComponentType type = getComponentType();
    // We retrieve all the implementations of the HadoopComponent service.
    BundleContext bc = getBundleContext();
    Collection<ServiceReference<? extends HadoopComponent>> distributions = new LinkedList<>();
    try {
        Class<? extends HadoopComponent> clazz = (Class<? extends HadoopComponent>) Class.forName(getServiceName());
        distributions.addAll(bc.getServiceReferences(clazz, null));
    } catch (InvalidSyntaxException | ClassNotFoundException e) {
        CommonExceptionHandler.process(e);
        return new HashMap<String, DistributionBean>();
    }
    Map<String, DistributionBean> disctributionsMap = new HashMap<>();
    for (ServiceReference<? extends HadoopComponent> sr : distributions) {
        addDistribution(bc, disctributionsMap, type, sr);
    }
    return disctributionsMap;
}
Also used : ComponentType(org.talend.hadoop.distribution.ComponentType) HashMap(java.util.HashMap) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean) LinkedList(java.util.LinkedList) ServiceReference(org.osgi.framework.ServiceReference) HadoopComponent(org.talend.hadoop.distribution.component.HadoopComponent) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) BundleContext(org.osgi.framework.BundleContext)

Example 2 with ComponentType

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

the class AbstractDynamicDistributionTemplate method buildModuleGroupsTemplateMap.

protected Map<ComponentType, IDynamicModuleGroupTemplate> buildModuleGroupsTemplateMap() {
    Map<ComponentType, IDynamicModuleGroupTemplate> moduleGroupsTemplateMap = new HashMap<>();
    DynamicPluginAdapter pluginAdapter = getPluginAdapter();
    if (this instanceof HDFSComponent) {
        moduleGroupsTemplateMap.put(ComponentType.HDFS, new DynamicHDFSModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof HBaseComponent) {
        moduleGroupsTemplateMap.put(ComponentType.HBASE, new DynamicHBaseModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof HCatalogComponent) {
        moduleGroupsTemplateMap.put(ComponentType.HCATALOG, new DynamicHCatalogModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof HiveComponent) {
        moduleGroupsTemplateMap.put(ComponentType.HIVE, new DynamicHiveModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof HiveOnSparkComponent) {
        moduleGroupsTemplateMap.put(ComponentType.HIVEONSPARK, new DynamicHiveOnSparkModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof MapRDBComponent) {
        moduleGroupsTemplateMap.put(ComponentType.MAPRDB, new DynamicMapRDBModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof MRComponent) {
        moduleGroupsTemplateMap.put(ComponentType.MAPREDUCE, new DynamicMapReduceModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof SparkBatchComponent) {
        moduleGroupsTemplateMap.put(ComponentType.SPARKBATCH, new DynamicSparkBatchModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof SparkStreamingComponent) {
        moduleGroupsTemplateMap.put(ComponentType.SPARKSTREAMING, new DynamicSparkStreamingModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof SqoopComponent) {
        moduleGroupsTemplateMap.put(ComponentType.SQOOP, new DynamicSqoopModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof ImpalaComponent) {
        moduleGroupsTemplateMap.put(ComponentType.IMPALA, new DynamicImpalaModuleGroupTemplate(pluginAdapter));
    }
    return moduleGroupsTemplateMap;
}
Also used : ImpalaComponent(org.talend.hadoop.distribution.component.ImpalaComponent) HashMap(java.util.HashMap) HiveOnSparkComponent(org.talend.hadoop.distribution.component.HiveOnSparkComponent) MRComponent(org.talend.hadoop.distribution.component.MRComponent) HiveComponent(org.talend.hadoop.distribution.component.HiveComponent) HDFSComponent(org.talend.hadoop.distribution.component.HDFSComponent) SqoopComponent(org.talend.hadoop.distribution.component.SqoopComponent) ComponentType(org.talend.hadoop.distribution.ComponentType) DynamicPluginAdapter(org.talend.hadoop.distribution.dynamic.adapter.DynamicPluginAdapter) HCatalogComponent(org.talend.hadoop.distribution.component.HCatalogComponent) HBaseComponent(org.talend.hadoop.distribution.component.HBaseComponent) SparkBatchComponent(org.talend.hadoop.distribution.component.SparkBatchComponent) SparkStreamingComponent(org.talend.hadoop.distribution.component.SparkStreamingComponent) MapRDBComponent(org.talend.hadoop.distribution.component.MapRDBComponent)

Example 3 with ComponentType

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

the class AbstractDynamicDistributionTemplate method buildNodeModuleGroupsMap.

protected Map<NodeComponentTypeBean, Set<DistributionModuleGroup>> buildNodeModuleGroupsMap(DynamicPluginAdapter pluginAdapter) throws Exception {
    Map<NodeComponentTypeBean, Set<DistributionModuleGroup>> nodeModuleGroupsMap = new HashMap<>();
    for (Map.Entry<ComponentType, IDynamicModuleGroupTemplate> entry : moduleGroupsTemplateMap.entrySet()) {
        Map<NodeComponentTypeBean, Set<DistributionModuleGroup>> groupMap = entry.getValue().getNodeModuleGroups();
        if (groupMap != null && !groupMap.isEmpty()) {
            for (Map.Entry<NodeComponentTypeBean, Set<DistributionModuleGroup>> groupEntry : groupMap.entrySet()) {
                NodeComponentTypeBean key = groupEntry.getKey();
                Set<DistributionModuleGroup> existingGroupSet = nodeModuleGroupsMap.get(key);
                if (existingGroupSet != null) {
                    String keyStr = "";
                    try {
                        ComponentType componentType = key.getComponentType();
                        if (componentType != null) {
                            keyStr = keyStr + componentType.name();
                        }
                        keyStr = keyStr + ", " + key.getComponentName();
                    } catch (Exception e) {
                        ExceptionHandler.process(e);
                    } finally {
                        CommonExceptionHandler.warn(this.getClass().getSimpleName() + " : multiple define of [" + keyStr + "], will merge it.");
                    }
                    existingGroupSet.addAll(groupEntry.getValue());
                } else {
                    nodeModuleGroupsMap.put(key, groupEntry.getValue());
                }
            }
        }
    }
    return nodeModuleGroupsMap;
}
Also used : ComponentType(org.talend.hadoop.distribution.ComponentType) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) DistributionModuleGroup(org.talend.hadoop.distribution.DistributionModuleGroup) NodeComponentTypeBean(org.talend.hadoop.distribution.NodeComponentTypeBean) HashMap(java.util.HashMap) Map(java.util.Map)

Example 4 with ComponentType

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

the class AbstractDynamicCDHDistributionTemplate 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 DynamicCDHHiveOnSparkModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof MRComponent) {
        groupTemplateMap.put(ComponentType.MAPREDUCE, new DynamicCDHMapReduceModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof SparkBatchComponent) {
        groupTemplateMap.put(ComponentType.SPARKBATCH, new DynamicCDHSparkBatchModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof SparkStreamingComponent) {
        groupTemplateMap.put(ComponentType.SPARKSTREAMING, new DynamicCDHSparkStreamingModuleGroupTemplate(pluginAdapter));
    }
    if (this instanceof SqoopComponent) {
        groupTemplateMap.put(ComponentType.SQOOP, new DynamicCDHSqoopModuleGroupTemplate(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) MRComponent(org.talend.hadoop.distribution.component.MRComponent) 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 5 with ComponentType

use of org.talend.hadoop.distribution.ComponentType 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;
}
Also used : ComponentType(org.talend.hadoop.distribution.ComponentType) ShowExpression(org.talend.hadoop.distribution.condition.ShowExpression) BasicExpression(org.talend.hadoop.distribution.condition.BasicExpression) ShowExpression(org.talend.hadoop.distribution.condition.ShowExpression) LinkedNodeExpression(org.talend.hadoop.distribution.condition.LinkedNodeExpression) Expression(org.talend.hadoop.distribution.condition.Expression) BasicExpression(org.talend.hadoop.distribution.condition.BasicExpression) RawExpression(org.talend.hadoop.distribution.condition.RawExpression) SimpleComponentCondition(org.talend.hadoop.distribution.condition.SimpleComponentCondition) MultiComponentCondition(org.talend.hadoop.distribution.condition.MultiComponentCondition) SimpleComponentCondition(org.talend.hadoop.distribution.condition.SimpleComponentCondition) NestedComponentCondition(org.talend.hadoop.distribution.condition.NestedComponentCondition) ComponentCondition(org.talend.hadoop.distribution.condition.ComponentCondition) MultiComponentCondition(org.talend.hadoop.distribution.condition.MultiComponentCondition) NestedComponentCondition(org.talend.hadoop.distribution.condition.NestedComponentCondition)

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