Search in sources :

Example 1 with DistributionBean

use of org.talend.hadoop.distribution.model.DistributionBean 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 DistributionBean

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

the class CreateHDFSAction method hideAction.

@Override
protected boolean hideAction(RepositoryNode node) {
    HadoopClusterConnectionItem hcConnectionItem = HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
    if (hcConnectionItem != null) {
        HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
        DistributionBean hdfsDistribution = HadoopDistributionsHelper.HDFS.getDistribution(hcConnection.getDistribution(), false);
        if (hdfsDistribution != null) {
            if (hdfsDistribution.getDisplayName() == EHadoopDistributions.GOOGLE_CLOUD_DATAPROC.getDisplayName()) {
                return true;
            }
            IHDistributionVersion hdVersion = hdfsDistribution.getHDVersion(hcConnection.getDfVersion(), false);
            if (hdVersion != null) {
                // found, don't hide
                return false;
            }
        }
    }
    return true;
}
Also used : IHDistributionVersion(org.talend.core.runtime.hd.IHDistributionVersion) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 3 with DistributionBean

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

the class CreateMaprdbAction method hideAction.

@Override
protected boolean hideAction(RepositoryNode node) {
    HadoopClusterConnectionItem hcConnectionItem = HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
    if (hcConnectionItem != null) {
        HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
        DistributionBean maprdbDistribution = HadoopDistributionsHelper.MAPRDB.getDistribution(hcConnection.getDistribution(), false);
        if (maprdbDistribution != null) {
            IHDistributionVersion hdVersion = maprdbDistribution.getHDVersion(hcConnection.getDfVersion(), false);
            if (hdVersion != null) {
                // found, don't hide
                if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopDistributionService.class)) {
                    IHadoopDistributionService hadoopService = (IHadoopDistributionService) GlobalServiceRegister.getDefault().getService(IHadoopDistributionService.class);
                    if (hadoopService != null) {
                        return !hadoopService.doSupportMapRTicket(hdVersion);
                    }
                }
            }
        }
    }
    return true;
}
Also used : IHadoopDistributionService(org.talend.core.hadoop.IHadoopDistributionService) IHDistributionVersion(org.talend.core.runtime.hd.IHDistributionVersion) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 4 with DistributionBean

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

the class HadoopSubMultiRepTypeProcessor method isValidAttributes.

private boolean isValidAttributes(RepositoryNode node) {
    if (node == null) {
        return true;
    }
    if (attributesMap != null && !attributesMap.isEmpty()) {
        HadoopClusterConnection hcConnection = HCRepositoryUtil.getRelativeHadoopClusterConnection(node.getId());
        if (hcConnection != null) {
            IElement elem = (IElement) attributesMap.get(ELEMENT);
            DistributionBean hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution(hcConnection.getDistribution(), false);
            if (hadoopDistribution != null) {
                DistributionVersion distributionVersion = hadoopDistribution.getVersion(hcConnection.getDfVersion(), false);
                if (distributionVersion != null && distributionVersion.hadoopComponent != null) {
                    boolean validated = true;
                    Object isSpark = attributesMap.get(ISSPARK);
                    if (isSpark != null && Boolean.valueOf(isSpark.toString())) {
                        validated = (validated && distributionVersion.hadoopComponent instanceof SparkComponent);
                        if (!validated) {
                            return false;
                        }
                    }
                    Object useYarn = attributesMap.get(USEYARN);
                    if (useYarn != null && Boolean.valueOf(useYarn.toString())) {
                        // CustomDistribution.doSupportSparkYarnClusterMode = true
                        if (ICustomDistribution.DISTRIBUTION_NAME.equals(distributionVersion.hadoopComponent.getDistribution())) {
                            validated = true;
                        } else {
                            validated = (validated && (distributionVersion.hadoopComponent.isHadoop2() || distributionVersion.hadoopComponent.isHadoop3()));
                        }
                        if (!validated) {
                            return false;
                        }
                    }
                }
            }
        }
    }
    return true;
}
Also used : IElement(org.talend.core.model.process.IElement) DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion) SparkComponent(org.talend.hadoop.distribution.component.SparkComponent) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 5 with DistributionBean

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

the class CreateHiveAction method hideAction.

@Override
protected boolean hideAction(RepositoryNode node) {
    HadoopClusterConnectionItem hcConnectionItem = HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
    if (hcConnectionItem != null) {
        HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
        DistributionBean hiveDistribution = HadoopDistributionsHelper.HIVE.getDistribution(hcConnection.getDistribution(), false);
        if (hiveDistribution != null) {
            IHDistributionVersion hdVersion = hiveDistribution.getHDVersion(hcConnection.getDfVersion(), false);
            if (hdVersion != null && !IMicrosoftHDInsightDistribution.DISTRIBUTION_NAME.equals(hdVersion.getDistribution().getName())) {
                // found and not HD Insight, don't hide
                return false;
            }
        }
    }
    return true;
}
Also used : IHDistributionVersion(org.talend.core.runtime.hd.IHDistributionVersion) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Aggregations

DistributionBean (org.talend.hadoop.distribution.model.DistributionBean)29 DistributionVersion (org.talend.hadoop.distribution.model.DistributionVersion)15 Test (org.junit.Test)8 IHDistributionVersion (org.talend.core.runtime.hd.IHDistributionVersion)8 HadoopClusterConnection (org.talend.repository.model.hadoopcluster.HadoopClusterConnection)7 HadoopComponent (org.talend.hadoop.distribution.component.HadoopComponent)6 HadoopClusterConnectionItem (org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem)6 SparkComponent (org.talend.hadoop.distribution.component.SparkComponent)4 IHadoopDistributionService (org.talend.core.hadoop.IHadoopDistributionService)2 SparkStreamingComponent (org.talend.hadoop.distribution.component.SparkStreamingComponent)2 AbstractDynamicDistributionTemplate (org.talend.hadoop.distribution.dynamic.template.AbstractDynamicDistributionTemplate)2 DynamicDistributionVersion (org.talend.hadoop.distribution.model.DynamicDistributionVersion)2 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1