Search in sources :

Example 11 with DistributionBean

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

the class HadoopDistributionsHelperTest method testGetHadoopDistributionByDisplayName.

@Test
public void testGetHadoopDistributionByDisplayName() {
    DistributionBean hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution(null, true);
    Assert.assertNull(hadoopDistribution);
    hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution("ABC", true);
    Assert.assertNull(hadoopDistribution);
}
Also used : DistributionBean(org.talend.hadoop.distribution.model.DistributionBean) Test(org.junit.Test)

Example 12 with DistributionBean

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

the class HadoopDistributionsHelperTest method testGetHadoopDistribution.

@Test
public void testGetHadoopDistribution() {
    DistributionBean hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution(null, false);
    Assert.assertNull(hadoopDistribution);
    hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution("ABC", false);
    Assert.assertNull(hadoopDistribution);
}
Also used : DistributionBean(org.talend.hadoop.distribution.model.DistributionBean) Test(org.junit.Test)

Example 13 with DistributionBean

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

the class HadoopClusterForm method switchToInfoForm.

private void switchToInfoForm() {
    if (hcInfoForm != null) {
        hcInfoForm.dispose();
    }
    DistributionBean hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution(distributionCombo.getText(), true);
    DistributionVersion hadoopVersion = hadoopDistribution.getVersion(versionCombo.getText(), true);
    if (HCVersionUtil.isHDI(getConnection())) {
        hcInfoForm = new HDIInfoForm(this, connectionItem, existingNamesArray, creation);
    } else if (HCVersionUtil.isSynapse(getConnection())) {
        hcInfoForm = new SynapseInfoForm(this, connectionItem, existingNamesArray, creation, hadoopDistribution, hadoopVersion);
    } else if (HCVersionUtil.isGoogleDataproc(getConnection())) {
        hcInfoForm = new GoogleDataprocInfoForm(this, connectionItem, existingNamesArray, creation, hadoopDistribution, hadoopVersion);
    } else if (HCVersionUtil.isDataBricks(getConnection())) {
        hcInfoForm = new DataBricksInfoForm(this, connectionItem, existingNamesArray, creation, hadoopDistribution, hadoopVersion);
    } else if (HCVersionUtil.isExecutedThroughKnox(getConnection()) && useKnoxButton.getSelection()) {
        hcInfoForm = new KnoxInfoForm(this, connectionItem, existingNamesArray, creation, hadoopDistribution, hadoopVersion);
    } else {
        hcInfoForm = new StandardHCInfoForm(this, connectionItem, existingNamesArray, creation, hadoopDistribution, hadoopVersion);
    }
    hcInfoForm.setReadOnly(readOnly);
    hcInfoForm.setListener(listener);
    hcInfoForm.updateForm();
    hcInfoForm.checkFieldsValue();
    this.layout();
}
Also used : DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 14 with DistributionBean

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

the class CreateHBaseAction method hideAction.

@Override
protected boolean hideAction(RepositoryNode node) {
    HadoopClusterConnectionItem hcConnectionItem = HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
    if (hcConnectionItem != null) {
        HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
        DistributionBean hbaseDistribution = HadoopDistributionsHelper.HBASE.getDistribution(hcConnection.getDistribution(), false);
        if (hbaseDistribution != null) {
            IHDistributionVersion hdVersion = hbaseDistribution.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 15 with DistributionBean

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

the class DistributionsManager method removeDistribution.

private void removeDistribution(BundleContext bc, Map<String, DistributionBean> distributionsMap, ComponentType type, ServiceReference<? extends HadoopComponent> sr) {
    HadoopComponent hc = bc.getService(sr);
    final String distribution = hc.getDistribution();
    final String distributionName = hc.getDistributionName();
    String key = getKey(hc);
    DistributionBean distributionBean = distributionsMap.get(key);
    if (distributionBean == null) {
        // not exsit, no need to remove
        return;
    } else {
        // check the name and displayName
        if (!distribution.equals(distributionBean.name) || !distributionName.equals(distributionBean.displayName)) {
            // $NON-NLS-1$
            CommonExceptionHandler.warn(" There are different distribution name for " + distributionBean);
        // return;
        }
    }
    clearCache();
    final String version = hc.getVersion();
    DistributionVersion versionBean = null;
    if (hc instanceof AbstractDynamicDistributionTemplate) {
        AbstractDynamicDistributionTemplate dynamicDistribution = (AbstractDynamicDistributionTemplate) hc;
        versionBean = new DynamicDistributionVersion(dynamicDistribution, distributionBean, type, version, hc.getVersionName(type));
    } else {
        versionBean = new DistributionVersion(hc, distributionBean, version, hc.getVersionName(type));
    }
    // special condition for current version
    versionBean.displayCondition = hc.getDisplayCondition(type);
    distributionBean.removeVersion(versionBean);
    distributionBean.setDefaultVersion(null);
    DistributionVersion[] versions = distributionBean.getVersions();
    if (versions == null || versions.length <= 0) {
        distributionsMap.remove(key);
    }
}
Also used : DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion) DynamicDistributionVersion(org.talend.hadoop.distribution.model.DynamicDistributionVersion) HadoopComponent(org.talend.hadoop.distribution.component.HadoopComponent) AbstractDynamicDistributionTemplate(org.talend.hadoop.distribution.dynamic.template.AbstractDynamicDistributionTemplate) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean) DynamicDistributionVersion(org.talend.hadoop.distribution.model.DynamicDistributionVersion)

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