Search in sources :

Example 16 with DistributionVersion

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

the class AdaptDeprecatedHadoopVersionsMigrationTask method execute.

@Override
public ExecutionResult execute(Item item) {
    if (item instanceof HadoopClusterConnectionItem) {
        DistributionBean[] distributions = HadoopDistributionsHelper.HADOOP.getDistributions();
        if (distributions != null && distributions.length > 0) {
            boolean modified = false;
            HadoopClusterConnectionItem hcItem = (HadoopClusterConnectionItem) item;
            HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcItem.getConnection();
            DistributionBean distributionBean = HadoopDistributionsHelper.HADOOP.getDistribution(hcConnection.getDistribution(), false);
            if (distributionBean == null) {
                distributionBean = distributions[0];
                hcConnection.setDistribution(distributionBean.getName());
                modified = true;
            }
            String version = hcConnection.getDfVersion();
            DistributionVersion distributionVersion = distributionBean.getVersion(version, false);
            if (distributionVersion == null) {
                DistributionVersion[] versions = distributionBean.getVersions();
                if (versions != null && versions.length > 0) {
                    hcConnection.setDfVersion(versions[0].getVersion());
                    modified = true;
                }
            }
            if (modified) {
                try {
                    ProxyRepositoryFactory.getInstance().save(hcItem, true);
                    return ExecutionResult.SUCCESS_NO_ALERT;
                } catch (PersistenceException e) {
                    ExceptionHandler.process(e);
                    return ExecutionResult.FAILURE;
                }
            }
        }
    }
    return ExecutionResult.NOTHING_TO_DO;
}
Also used : DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion) PersistenceException(org.talend.commons.exception.PersistenceException) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 17 with DistributionVersion

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

the class StandardHCInfoForm method isCurrentHadoopVersionSupportGroup.

private boolean isCurrentHadoopVersionSupportGroup() {
    boolean supportGroup = false;
    final DistributionVersion distributionVersion = getDistributionVersion();
    if (distributionVersion != null && distributionVersion.hadoopComponent != null) {
        supportGroup = distributionVersion.hadoopComponent.doSupportGroup();
    }
    return supportGroup;
}
Also used : DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion)

Example 18 with DistributionVersion

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

the class AbstractHadoopSubForm method isCurrentHadoopVersionSupportGroup.

private boolean isCurrentHadoopVersionSupportGroup() {
    boolean supportGroup = false;
    DistributionVersion distributionVersion;
    DistributionBean distributionBean = HadoopDistributionsHelper.HADOOP.getDistribution(distribution, false);
    if (distributionBean != null) {
        distributionVersion = distributionBean.getVersion(version, false);
        IHadoopDistributionService hadoopDistributionService = (IHadoopDistributionService) GlobalServiceRegister.getDefault().getService(IHadoopDistributionService.class);
        if (distributionVersion != null && hadoopDistributionService != null) {
            try {
                supportGroup = hadoopDistributionService.doSupportMethod(distributionVersion, "doSupportGroup");
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
    return supportGroup;
}
Also used : IHadoopDistributionService(org.talend.core.hadoop.IHadoopDistributionService) DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 19 with DistributionVersion

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

the class HadoopImportConfsOptionPage method updateVersionPart.

private void updateVersionPart() {
    DistributionBean distribution = getDistribution();
    if (distribution == null) {
        return;
    }
    versionCombo.getCombo().setItems(distribution.getVersionsDisplay());
    DistributionVersion defaultVersion = distribution.getDefaultVersion();
    if (defaultVersion != null && defaultVersion.displayVersion != null) {
        versionCombo.getCombo().setText(defaultVersion.displayVersion);
    } else {
        versionCombo.getCombo().select(0);
    }
}
Also used : DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 20 with DistributionVersion

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

the class RetrieveLocalConfsServiceTest method getServiceWithDistribution.

private static IRetrieveConfsService getServiceWithDistribution(String distributionName, String versionName) {
    DistributionBean distribution = HadoopDistributionsHelper.HADOOP.getDistribution(distributionName, false);
    DistributionVersion version = distribution.getVersion(versionName, false);
    return new RetrieveLocalConfsService(confDir.getAbsolutePath(), version);
}
Also used : DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Aggregations

DistributionVersion (org.talend.hadoop.distribution.model.DistributionVersion)23 DistributionBean (org.talend.hadoop.distribution.model.DistributionBean)15 HadoopComponent (org.talend.hadoop.distribution.component.HadoopComponent)5 SparkComponent (org.talend.hadoop.distribution.component.SparkComponent)4 Test (org.junit.Test)3 IHDistributionVersion (org.talend.core.runtime.hd.IHDistributionVersion)3 HadoopClusterConnection (org.talend.repository.model.hadoopcluster.HadoopClusterConnection)3 ESparkVersion (org.talend.hadoop.distribution.ESparkVersion)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 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 Set (java.util.Set)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 Ignore (org.junit.Ignore)1 PersistenceException (org.talend.commons.exception.PersistenceException)1